Advertisement
Guest User

Untitled

a guest
Aug 15th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. int WhiteLed = 2;
  2. int Sensor = A5;
  3. int sensorValue = 0;
  4.  
  5. void setup () {
  6.   pinMode (WhiteLed, OUTPUT);
  7.   Serial.begin (9600);
  8. }
  9.  
  10. void loop () {
  11.   sensorValue = analogRead (Sensor);
  12.   if (sensorValue < 50&& sensorValue < 500)
  13.   {
  14.   digitalWrite (WhiteLed, HIGH);
  15.   Serial.println (sensorValue, DEC);
  16.   }
  17.   else (sensorValue > 500&& sensorValue > 1023);
  18.   {
  19.   digitalWrite (WhiteLed, LOW);
  20.   Serial.println (sensorValue, DEC);
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement