Advertisement
NosefU

Untitled

Feb 7th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. int time = 0;
  2.  
  3. void setup() {
  4.  
  5.   Serial.begin(9600);
  6.   pinMode(8, OUTPUT);
  7. }
  8.  
  9.  
  10. void loop() {
  11.   int  comparator= analogRead(A0);
  12.   int potentiometer = analogRead(A1);
  13.   if (comparator > 100) {
  14.   Serial.print("Potentiometer: ");
  15.   Serial.print(potentiometer, DEC);
  16.   Serial.print("   Comparator: ");
  17.   Serial.print(comparator, DEC);
  18.   Serial.print("   Time: ");
  19.   Serial.println(time, DEC);
  20.   delay(5);
  21.   if (millis()-time < 500) {
  22.     digitalWrite(8, !digitalRead(8));   // turn the LED on (HIGH is the voltage level)
  23.     Serial.println("   ");
  24.     delay(1000);
  25.   }
  26.   time = millis();
  27.   }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement