{"id":752,"date":"2017-06-06T19:39:01","date_gmt":"2017-06-06T19:39:01","guid":{"rendered":"http:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/?p=752"},"modified":"2017-06-14T11:45:46","modified_gmt":"2017-06-14T11:45:46","slug":"liczymy-obroty-tcrt5000-sukces","status":"publish","type":"post","link":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/?p=752","title":{"rendered":"Liczymy obroty (TCRT5000) &#8211; sukces!"},"content":{"rendered":"<h2>Liczymy obroty silniczka D65:<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"https:\/\/photos05.redcart.pl\/templates\/images\/thumb\/995\/800\/800\/pl\/0\/templates\/images\/products\/995\/fe1b44f908af0d09d6f8c4fbdc6aa8fc.jpg\" alt=\"Znalezione obrazy dla zapytania d65 zestaw napedowy\" width=\"334\" height=\"308\">tutaj nasz&nbsp;program:<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"lang:arduino decode:true \" title=\"zliczanie szybkosci obrotowej\">bool stan, poprz;\r\nunsigned long int t1;\r\n\r\nvoid setup() {\r\n  \/\/ put your setup code here, to run once:\r\n  Serial.begin(9600);\r\n  stan=false;\r\n}\r\n\r\nint odczyt;\r\nint licz=0;\r\nvoid loop() {\r\n  poprz=stan;\r\n  odczyt=analogRead(A0);\r\n  if (odczyt&lt;50)\r\n    stan=true;\r\n  else\r\n    stan=false;\r\n\/\/  Serial.print(odczyt);\r\n\/\/  Serial.print(\"   \");\r\n\/\/  Serial.print(stan?\"jasne\":\"ciemne\");\r\n\/\/  Serial.print(\"   \");\r\n  if (stan!=poprz){\r\n    licz++;\r\n    Serial.print(\" KLIK \");\r\n    Serial.print(licz);\r\n    Serial.print(\" \");\r\n    if (licz%2==0){\r\n      Serial.print(1000.\/(millis() - t1)*60);\r\n      Serial.println(\" rpm\");\r\n      t1= millis();\r\n    }\r\n  }\r\n\/\/  else\r\n\/\/    Serial.println();\r\n}\r\n<\/pre>\n<p>I dzia\u0142a bardzo fajnie, nawet z tylko jednym znacznikiem! Wyniki s\u0105 bardzo powtarzalne (przy zasilaniu oko\u0142o 7V &#8211; jeden obr\u00f3t w 230-240ms, czyli 4 obroty w 1 sekund\u0119, a to daje 4*60=240 obrot\u00f3w na minut\u0119 &#8211; rpm).<\/p>\n<p>Rozbudowa?<\/p>\n<ol>\n<li>wi\u0119cej znacznik\u00f3w (ju\u017c 2 polepszaj\u0105 spraw\u0119, 4 to zdecydowanie OK).<\/li>\n<li>inny algorytm &#8211; zliczanie liczny obrot\u00f3w i aktualizowanie warto\u015bci rpm co okre\u015blony czas, np. 2 sek<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Liczymy obroty silniczka D65: tutaj nasz&nbsp;program: &nbsp; bool stan, poprz; unsigned long int t1; void setup() { \/\/ put your setup code here, to run once: Serial.begin(9600); stan=false; } int odczyt; int licz=0; void loop() { poprz=stan; odczyt=analogRead(A0); if (odczyt&lt;50) stan=true; else stan=false; \/\/ Serial.print(odczyt); \/\/ Serial.print(&#8221; &#8222;); \/\/ Serial.print(stan?&#8221;jasne&#8221;:&#8221;ciemne&#8221;); \/\/ Serial.print(&#8221; &#8222;); if (stan!=poprz){ [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":306,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[52],"tags":[22,162,161,16,29,40],"class_list":{"0":"post-752","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-fibot","8":"tag-enkoder","9":"tag-obroty","10":"tag-pomiar","11":"tag-silnik","12":"tag-tcrt","13":"tag-tcrt5000","15":"post-with-thumbnail","16":"post-with-thumbnail-large"},"_links":{"self":[{"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=\/wp\/v2\/posts\/752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=752"}],"version-history":[{"count":1,"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=\/wp\/v2\/posts\/752\/revisions"}],"predecessor-version":[{"id":753,"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=\/wp\/v2\/posts\/752\/revisions\/753"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=\/wp\/v2\/media\/306"}],"wp:attachment":[{"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/physics.uwb.edu.pl\/wf\/fi-bot\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}