Vježba 3, spajanje optičkih senzora i provjera preko mbeda.

Dependencies:   mbed

Opticki_senzor_long_code.cpp

Committer:
JosipLupinski
Date:
2016-11-02
Revision:
0:65d0d2104921

File content as of revision 0:65d0d2104921:

#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;

        }
    
}