<\/a><\/p>\nEl dise\u00f1o electr\u00f3nico es simple… por eso solo me decantar\u00e9 por mostrar el programa.<\/p>\n
[sourcecode language=\u00bbpy\u00bb]
\n\/*
\n * Reflex control timelapse & long exposure.
\n * By Walter L\u00f3pez Pascual (Walii & walterleonardo)
\n * Pins, Schematics and more info:
\n * http:\/\/pinguino.walii.es
\n *\/<\/p>\n
\/\/ Comment line above if you using a pinguino with PIC18F2550.
\n#define PIC18F4550<\/p>\n
#define BOTON1 4
\n#define BOTON2 5
\n#define BOTON3 6
\n#define BOTON4 7
\n#define BOTON5 10
\n#define SHOT 28
\n#define LDR 13
\n#define VREF 14
\n#define VMON 15
\n#define LED 23
\n#define BUZZ 22
\n#define LCD 21<\/p>\n
\/\/global vars
\nuchar counter = 0;
\nint tiempo=0;
\nint segundos=0;
\nint i;
\nint cantidad=1;
\nint contador=0;
\nfloat num;
\nint pausa;
\nint cuenta;
\nint encendida=0;
\nfloat oldr,ldr;
\nfloat intermedio[];
\nint ldractivado=0;<\/p>\n
void lecturaoldr()
\n{
\nfor (i=0;i<10;i++)
\n{
\nintermedio[i]=analogRead(LDR);
\noldr=oldr+intermedio[i];
\n}
\noldr=oldr\/10;
\n}<\/p>\n
void lecturaldr()
\n{
\nfor (i=0;i<10;i++)
\n{
\nintermedio[i]=analogRead(LDR);
\nldr=ldr+intermedio[i];
\n}
\nldr=ldr\/10;
\n}<\/p>\n
void setup(){
\n\t\/\/8 bits mode
\n\t\/\/lcd(8, 9, 0, 1, 2, 3, 4, 5, 6, 7); \/\/ RS, E, D0 ~ D7<\/p>\n
\t\/\/4 bits mode, dont use last four pins …
\n\tlcd(8, 9, 0, 1, 2, 3, 0, 0, 0, 0); \/\/ RS, E, D4 ~ D8<\/p>\n
\t\/\/LCD format
\n\tlcd.begin(3, 0);<\/p>\n
\t\/* Debug *\/
\n\tpinMode(BOTON1, INPUT);\t\t\/\/ LED on pin 13
\n\tdigitalWrite( BOTON1,LOW);
\n\tpinMode(BOTON2, INPUT);\t\t\/\/ LED on pin 13
\n\tdigitalWrite( BOTON2,LOW);
\n\tpinMode(BOTON3, INPUT);\t\t\/\/ LED on pin 13
\n\tdigitalWrite( BOTON3,LOW);
\n\tpinMode(BOTON4, INPUT);\t\t\/\/ LED on pin 13
\n\tdigitalWrite( BOTON4,LOW);
\n\tpinMode(BOTON5, INPUT);\t\t\/\/ LED on pin 13
\n\tdigitalWrite( BOTON5,LOW);
\n\tpinMode(SHOT, INPUT);\t\t\/\/ LED on pin 13
\n\tdigitalWrite( SHOT,LOW);
\n\tpinMode(LED,OUTPUT);\t\t\/\/ LED on pin 13
\n\tdigitalWrite( LED,LOW);
\n\tpinMode(BUZZ,OUTPUT);\t\t\/\/ LED on pin 13
\n\tdigitalWrite( BUZZ,LOW);
\n\tpinMode(LCD,OUTPUT);\t\t\/\/ LED on pin 13
\n\tdigitalWrite( LCD,LOW);
\n\tlecturaoldr();
\n}<\/p>\n
void dispara(int pausa)
\n{
\ntono1();
\ndigitalWrite(LED,HIGH);
\ndelay(pausa);
\ndigitalWrite(LED,LOW);
\n}<\/p>\n
void longexpo()
\n{
\n_millis = 0;
\nwhile (millis()<=5000)
\n{
\nsegundos=millis()\/1000;
\nlcd.setCursor(0, 2);
\nlcd.print("Start-time in ");
\nlcd.printNumber(5-segundos,10);
\nlcd.print(" ");
\nlcd.setCursor(0, 3);
\nlcd.print(" ");
\n}<\/p>\n
contador=1;
\nwhile (contador<=cantidad)
\n{
\n_millis = 0;
\ntono2();
\n\twhile (millis()<=tiempo*1000)
\n\t{
\n\tdigitalWrite(LED,HIGH);
\nlcd.setCursor(0, 2);
\nlcd.print("Time to End ");
\nsegundos=millis()\/1000;
\nlcd.printNumber(tiempo-segundos,10);
\nlcd.print(" ");
\nlcd.setCursor(0, 3);
\nlcd.print("Shot to End ");
\nlcd.printNumber(cantidad-contador,10);
\n\t}
\ndigitalWrite(LED,LOW);
\nlcd.setCursor(0, 2);
\nlcd.print("Time to End ");
\nlcd.printNumber(0,10);
\nlcd.print(" ");
\nlcd.setCursor(0, 3);
\nlcd.print("Shot to End ");
\nlcd.printNumber(cantidad-contador,10);
\ndelay(2000);
\ncontador++;
\n}<\/p>\n
}<\/p>\n
void timelapse()
\n{
\n_millis = 0;
\ncontador=1;
\nwhile (contador<=cantidad)
\n{
\nlcd.setCursor(0, 2);
\nlcd.print("ShotN ");
\nlcd.printNumber(cantidad-contador+1,10);
\nlcd.print(" Wtime ");
\nlcd.printNumber(tiempo,10);
\nlcd.setCursor(0, 3);
\nsegundos=millis()\/1000;
\nlcd.print(" Working … ");<\/p>\n
while (segundos!=tiempo)
\n{
\nsegundos=millis()\/1000;
\ndigitalWrite(LED,LOW);
\n}
\ndispara(1000);
\n_millis = 0;
\ncontador++;<\/p>\n
}<\/p>\n
}<\/p>\n
void tono1()
\n{
\ndigitalWrite(BUZZ,HIGH);
\ndelay(200);
\ndigitalWrite(BUZZ,LOW);
\n}<\/p>\n
void tono2()
\n{
\ndigitalWrite(BUZZ,HIGH);
\ndelay(50);
\ndigitalWrite(BUZZ,LOW);
\ndelay(50);
\ndigitalWrite(BUZZ,HIGH);
\ndelay(50);
\ndigitalWrite(BUZZ,LOW);
\n}<\/p>\n
void loop()
\n{
\n\tlecturaldr();
\n\tlcd.home();
\n\tlcd.print("ShotControl");\t\/\/ Output char
\n\tlcd.print(" ldr ");\t\/\/ Output char
\n\tlcd.printNumber(ldr,10);\t\/\/ Output char
\n\t\tlcd.print(" ");\t\/\/ Output char
\n\tlcd.setCursor(0, 1);
\nif (digitalRead(BOTON4)) lcd.print("Long exposure ");
\nelse lcd.print("Time Lapse ");
\nif(digitalRead(BOTON1) && digitalRead(BOTON4)) longexpo();
\nelse if(digitalRead(BOTON1) && digitalRead(BOTON4)==0) timelapse();
\nif(digitalRead(BOTON5))
\n{
\nif (encendida) encendida=0;
\nelse encendida=1;
\ndelay(200);
\n}
\nif(digitalRead(BOTON2)) delay(200), tiempo++;
\nif(digitalRead(BOTON3)) delay(200), cantidad++;
\nif(digitalRead(SHOT)) dispara(200);
\nif(ldr<=oldr-10 && ldractivado==1) dispara(200); if (tiempo >= 1000) tiempo = 1000;
\nif (tiempo <= 1) tiempo = 1;
\nif (encendida) digitalWrite(LCD,HIGH);
\nif (!encendida) digitalWrite(LCD,LOW);
\nlcd.setCursor(0, 2);
\nlcd.print("ShotN ");
\nlcd.printNumber(cantidad,10);
\nlcd.print(" Wtime ");
\nlcd.printNumber(tiempo,10);
\nlcd.print(" ");
\nlcd.setCursor(0, 3);
\nsegundos=millis()\/1000;
\nlcd.print(" -Esperando comando-");
\n}<\/p>\n
[\/sourcecode]<\/p>\n","protected":false},"excerpt":{"rendered":"
Hola a todos… perd\u00f3n el titulo en ingles… pero suena como mas importante… ya que para mi este es un invento muy\u00a0\u00fatil… porque ultima-mente estuve…<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,3,15],"tags":[],"_links":{"self":[{"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts\/518"}],"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=518"}],"version-history":[{"count":5,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts\/518\/revisions"}],"predecessor-version":[{"id":524,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=\/wp\/v2\/posts\/518\/revisions\/524"}],"wp:attachment":[{"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pinguino.walii.es\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}