Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
443 B
4
Indexable
Never
 
byte voltPin = 2; //pin digitale arduino
bool readValue; //true o false

void setup() {
  pinMode(voltPin, INPUT); 
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  readValue =  digitalRead()(voltPin); // lettura digitale
  if (readValue) {                     //se truee
    digitalWrite(LED_BUILTIN, HIGH);
  } else {                             //se false
    digitalWrite(LED_BUILTIN, LOW);
  }
}
Leave a Comment