Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.69 KB | None | 0 0
  1. // Two Switch Blink
  2.      
  3.     int sensorPin = 2;               // select the input pin for the read
  4.     int ledPin = 13;                 // select the pin for the LED
  5.     int sensorValue = 0;             // variable to store the value coming from the sensor  
  6.  
  7.     void setup() {  
  8.     pinMode(ledPin, OUTPUT);        
  9.     Serial.begin(9600);
  10.   }
  11.  
  12.  
  13.     void loop(){
  14.     Serial.println(sensorValue);
  15.     sensorValue = analogRead(sensorPin);  // read the value from the sensor:    
  16.     digitalWrite(ledPin, HIGH);          
  17.     delay(sensorValue);                        
  18.     digitalWrite(ledPin, LOW);            
  19.     delay(sensorValue);                  
  20.      
  21.      
  22.      
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement