Advertisement
cressidagp

Arduino Bomba

Oct 18th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. /*
  2.   IPEA N14
  3.  
  4.   EXPO 2023
  5.  
  6. */
  7.  
  8. void setup(){
  9.  
  10.   pinMode( 7, OUTPUT );
  11.   pinMode( A0, INPUT);
  12.  
  13.   //Serial.begin( 9600 ); //for debug
  14.  
  15. }
  16.  
  17. void loop(){
  18.  
  19.   int value = analogRead( A0 );
  20.  
  21.   //Serial.println( value ); //for debug
  22.  
  23.   if( value > 500 ){
  24.  
  25.     digitalWrite( 7, LOW );
  26.  
  27.   }
  28.  
  29.   else {
  30.  
  31.     digitalWrite( 7, HIGH );
  32.    
  33.   }
  34.  
  35.   delay( 5000 );
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement