Dragon_Saphir

Untitled

Jan 21st, 2021
686
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int DigitalPinOut = 2;
  2. int AnalogPin = A0;
  3. int AnalogValue;
  4.  
  5. void setup()
  6. {
  7.   pinMode(DigitalPinOut, OUTPUT);
  8.   pinMode(AnalogPin, INPUT);
  9.   Serial.begin(9600);
  10. }
  11.  
  12. void loop()
  13. {
  14.   delay(1);
  15.   AnalogValue = analogRead(AnalogPin);
  16.   Serial.println(AnalogValue);
  17.   if(AnalogValue > 0)
  18.   {
  19.     digitalWrite(DigitalPinOut, HIGH);  //ein
  20.     delay(1);
  21.   }
  22.   else
  23.   {
  24.     delay(1000);
  25.     digitalWrite(DigitalPinOut, LOW);   //aus
  26.   }
  27. }
RAW Paste Data