{"id":370,"date":"2010-12-05T00:47:49","date_gmt":"2010-12-04T22:47:49","guid":{"rendered":"http:\/\/pinguino.walii.es\/?p=370"},"modified":"2010-12-05T01:07:24","modified_gmt":"2010-12-04T23:07:24","slug":"automatismo-de-luz-navidena-con-pinguino","status":"publish","type":"post","link":"https:\/\/pinguino.walii.es\/?p=370","title":{"rendered":"Automatismo de luz navide\u00f1a…con PINGUINO"},"content":{"rendered":"

\"\"<\/a>Bueno siguiendo el tema de chorradas, y luego del burbujometro \ud83d\ude42 se me ocurri\u00f3 montar el bel\u00e9n navide\u00f1o, pero al terminarlo lo vi medio fofo… y pens\u00e9 que quedaria bonito si automatizamos un poco la cosa y ponemos alguna que otra luz.
\nEl tema de tener que darle a un interruptor me molestaba, as\u00ed que he realizado una especie de interruptor infrarrojo, para activar con solo pasar la mano delante de la estrella, y durante un tiempo de cerca de un minuto las luces y algunos cambios de color…
\nEspero os guste, es una tonter\u00eda pero facil de hacer y de replicar.<\/p>\n

<\/embed><\/object><\/span><\/p>\n

\n

<\/embed><\/object><\/p>\n

\n


\n<\/span><\/p>\n

\"\"<\/a><\/p>\n

\"\"<\/a>Las lineas marcadas con \/\/debug son para ir corrigiendo en tiempo real la respuesta del PINGUINO.<\/p>\n

\n

[sourcecode language=\u00bbpy\u00bb]<\/p>\n

\/*
\n * Walii PINGUINO PIC
\n * http:\/\/pinguino.walii.es
\n*
\n*Espa\u00f1ol
\n* Un sensor para el BELEN, para que cuando pasas la mano por delante
\n* se enciendan las luces de decoraci\u00f3n, durante un minuto aproximadamente
\n*English
\n* A sensor for BELEN, so that when you pass your hand in front of this
\n* the lights decoration ON, these for about a minute.
\n *\/<\/p>\n

int redPin = 2; \t\/\/ R petal on RGB LED module connected to digital pin 2
\nint greenPin = 1; \t\/\/ G petal on RGB LED module connected to digital pin 1
\nint bluePin = 0; \t\/\/ B petal on RGB LED module connected to digital pin 0
\nint valueir;\t\t\/\/IR SENSOR
\nint i;
\nint timer=0;<\/p>\n

void setup()
\n{
\n for (i=0;i<8;i++)
\n\t{
\n\tpinMode(i,OUTPUT);\t\t\/\/ Config all the port like OUTPUT
\n\tdigitalWrite(i,LOW);\t\t\/\/ fixed all exit to LOW
\n\t}
\nSerial.begin(9600);\t\t\/\/debug
\n}
\nvoid color (uchar red, uchar green, uchar blue) \/\/ the color generating function
\n{
\n digitalWrite(redPin,red);
\n digitalWrite(bluePin,blue);
\n digitalWrite(greenPin,green);
\n}<\/p>\n

void loop() \t\/\/ run over and over again
\n{
\nvalueir=analogRead(13); \/\/Read analog port
\n\/\/Serial.print("valor ir ");\t\/\/debug
\n\/\/Serial.print(valueir,DEC);\t\/\/debug
\n\/\/Serial.print("\\n\\r");\t\t\/\/debug
\nif (valueir<100) timer=50;\t\t\/\/Control IR SENSOR
\n\/\/Serial.print("valor timer ");\t\/\/debug
\n\/\/Serial.print(timer,DEC);\t\t\/\/debug
\n\/\/Serial.print("\\n\\r");\t\t\/\/debug<\/p>\n

while (timer>1) \/\/Make this only if timer is > 1
\n{
\n\/\/Serial.print("valor timer ");\t\/\/debug
\n\/\/Serial.print(timer,DEC); \t\/\/debug
\n\/\/Serial.print("\\n\\r"); \t\t\/\/debug
\nanalogWrite(11,1000);\t\/\/ 99% pwm 11
\ncolor(HIGH, LOW, LOW); \t\/\/ turn the RGB LED red
\n\t\tdelay(500); \t\/\/ delay for 1\/2 second
\nanalogWrite(11,500);\t\t\/\/ 50% pwm 11
\ncolor(LOW, HIGH, LOW); \t\/\/ turn the RGB LED green
\n\t\tdelay(500);\t\/\/ delay for 1\/2 second
\nanalogWrite(11,1000);\t\/\/ 99% pwm 11
\ncolor(LOW, LOW, HIGH); \t\/\/ turn the RGB LED blue
\n\t\tdelay(500); \t\/\/ delay for 1\/2 second
\nanalogWrite(11,800);\t\t\/\/ 80% pwm 11
\ntimer–;
\n}
\nanalogWrite(11,0);\t\t\/\/Off the PWM pin
\ncolor(LOW, LOW, LOW); \t\/\/Off all the ligths
\ndelay(100);\t\t\t\/\/ Wait 100ms
\n}<\/p>\n

[\/sourcecode]<\/p>\n","protected":false},"excerpt":{"rendered":"

Bueno siguiendo el tema de chorradas, y luego del burbujometro \ud83d\ude42 se me ocurri\u00f3 montar el bel\u00e9n navide\u00f1o, pero al terminarlo lo vi medio fofo……<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,5],"tags":[],"_links":{"self":[{"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts\/370"}],"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=370"}],"version-history":[{"count":9,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts\/370\/revisions"}],"predecessor-version":[{"id":394,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts\/370\/revisions\/394"}],"wp:attachment":[{"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}