{"id":231,"date":"2010-08-23T13:11:28","date_gmt":"2010-08-23T10:11:28","guid":{"rendered":"http:\/\/pinguino.walii.es\/archives\/231"},"modified":"2010-10-09T20:37:32","modified_gmt":"2010-10-09T17:37:32","slug":"jugueteando-con-la-beta9-y-la-libreria-de-servos","status":"publish","type":"post","link":"https:\/\/pinguino.walii.es\/?p=231","title":{"rendered":"Jugueteando con la BETA9 y la librer\u00eda de servos"},"content":{"rendered":"

Aqu\u00ed un dise\u00f1o r\u00e1pido y educativo de PINGUINO, utilizando las librer\u00edas de servos he realizado este seguidor de sol, para nuestros proyectos solares\u2026.<\/p>\n

[sourcecode language=\u00bbpy\u00bb]
\n\/\/ Seguidor solar con libreria de servo beta9
\n\/\/ Walii walterleonardo@gmail.com 2010
\n#define PIC18F4550
\nuchar pos = 0; \/\/ Variable to store the servo position.
\nint inputPhotoLeft = 13; \/\/LDR left sensor
\nint inputPhotoRight = 14; \/\/LDR right sensor
\nint Left = 0; \/\/ Store readings from the photoresistors.
\nint Right = 0; \/\/ Store readings from the photoresistors.
\nint servo1 = 0; \/\/ Attach servo to pin 0.
\nvoid setup()
\n{
\nservo.attach(servo1);
\n}
\nvoid loop()
\n{
\n\/\/ Reads the values from the photoresistors to the Left and Right variables.
\nLeft = analogRead(inputPhotoLeft);
\nRight = analogRead(inputPhotoRight);
\n\/\/ Checks if right is greater than left, if so move to right.
\nif (Left &gt; (Right +10))
\n\/\/ +10 is the deadzone, so it won’t jiggle back and forth.
\n{
\nif (pos &lt; 179) pos++; servo.write(servo1,pos); } \/\/ Checks if left is greater than right, if so move to \/\/left. if (Right &gt; (Left +10))
\n\/\/ +10 is the deadzone, so it won’t jiggle back and forth.
\n{
\nif (pos &gt; 1)
\npos -= 1;
\nservo.write(servo1,pos);
\n}
\n\/\/ Added ALOT of delay, increase or decrease if you want less or more speed.
\ndelay(70);
\n}
\n[\/sourcecode]<\/p>\n

Saludos<\/p>\n","protected":false},"excerpt":{"rendered":"

Aqu\u00ed un dise\u00f1o r\u00e1pido y educativo de PINGUINO, utilizando las librer\u00edas de servos he realizado este seguidor de sol, para nuestros proyectos solares\u2026. [sourcecode language=\u00bbpy\u00bb]…<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts\/231"}],"collection":[{"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=231"}],"version-history":[{"count":6,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions"}],"predecessor-version":[{"id":294,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions\/294"}],"wp:attachment":[{"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}