weturtle

arduino_ricevitore

Feb 17th, 2019
4,052
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Dichiarazione del pin a cui è connessa la fotoresistenza const int photor = 11;
  2. const int IRread = 2;
  3.  
  4. void setup() {
  5.     //Avvio della seriale
  6.     Serial.begin(9600);
  7.  
  8.     //Fotoresistenza impostata come INPUT
  9.     pinMode(photor,INPUT);
  10.     pinMode(IRread,INPUT);
  11. }
  12.  
  13. void loop() {
  14.     if(digitalRead(IRread)==LOW){
  15.         Serial.println("IR Ricevuto");
  16.         delay(500);
  17.  
  18.         for(int y = 0; y < 4; y++){ for(int i = 0;i<5;i++){
  19.             Serial.print((abs(digitalRead(photor)-1))); delay(1000);
  20.         }
  21.     Serial.println();
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment