Vježba 3, spajanje optičkih senzora i provjera preko mbeda.
Dependencies: mbed
Revision 0:65d0d2104921, committed 2016-11-02
- Comitter:
- JosipLupinski
- Date:
- Wed Nov 02 18:08:34 2016 +0000
- Commit message:
- Vjezba 3
Changed in this revision
diff -r 000000000000 -r 65d0d2104921 Optick_senzor_short_code.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Optick_senzor_short_code.cpp Wed Nov 02 18:08:34 2016 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" + +DigitalOut myled1 (LED1); +DigitalOut myled2 (LED2); +DigitalIn reflective (p5); +DigitalIn transmissive (p15); + +int main() { + + while(true){ + + //lamapice se pale kada se prekine dovod svjetla na senzore + myled1 = !reflective; + myled2 = transmissive; + + } + +} \ No newline at end of file
diff -r 000000000000 -r 65d0d2104921 Opticki_senzor_long_code.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Opticki_senzor_long_code.cpp Wed Nov 02 18:08:34 2016 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +DigitalOut myled1 (LED1); +DigitalOut myled2 (LED2); +DigitalIn switchInput1 (p5); +DigitalIn switchInput2 (p15); + +int main() { + + int switchState1, switchState2; + + while(true){ + + //lamapice se pale kada se prekine dovod svjetla na senzore + switchState1 = switchInput1.read(); + switchState2 = switchInput2.read(); + + if(switchState1 == 1) myled1 = 0; + else myled1 = 1; + + if(switchState2 == 1) myled2 = 1; + else myled2 = 0; + + } + +} \ No newline at end of file
diff -r 000000000000 -r 65d0d2104921 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Nov 02 18:08:34 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0 \ No newline at end of file