
El de mi banda transportadora + FPGA
Revision 0:c2a236756265, committed 2011-12-13
- Comitter:
- adrianmb
- Date:
- Tue Dec 13 02:36:59 2011 +0000
- Commit message:
- El de mi banda transportadora + FPGA
Changed in this revision
diff -r 000000000000 -r c2a236756265 Servo.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Tue Dec 13 02:36:59 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/Servo/#36b69a7ced07
diff -r 000000000000 -r c2a236756265 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 13 02:36:59 2011 +0000 @@ -0,0 +1,65 @@ +#include "mbed.h" +#include "Servo.h" + +Servo servo(p21); + +DigitalOut l1(LED1); +DigitalOut l2(LED2); +DigitalOut l3(LED3); + +DigitalIn posServo(p26); +DigitalOut ready(p27); +DigitalOut figura(p28); +InterruptIn inicio(p29); +InterruptIn foto(p30); + +Serial pc(USBTX,USBRX); +char in; + +void tomarFoto() { + pc.putc('f'); + l3=1; + ready=0; +} + +void reset() { + ready=0; + figura=0; + l3=0; +} + +void dataIn() { + if (pc.readable()) { + in=pc.getc(); + switch (in) { + case '0': + figura=0; + ready=1; + break; + case '1': + figura=1; + ready=1; + break; + } + } +} + +int main() { + pc.baud(9600); + pc.attach(&dataIn); + foto.rise(&tomarFoto); + inicio.rise(&reset); + foto.mode(PullDown); + inicio.mode(PullDown); + posServo.mode(PullDown); + + while (1) { + l1=ready; + l2=figura; + if (posServo==1) { + servo=1; + } else { + servo=0; + } + } +} \ No newline at end of file
diff -r 000000000000 -r c2a236756265 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 13 02:36:59 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912