e.g.,
if (digitalRead(16)==0) {
// do stuff...
pinMode(16,OUTPUT);
digitalWrite(16,HIGH);
delay(1);
pinMode(16,INPUT);
const int buttonPin = 16;
const int ledPin = 1;
void setup() {
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
if (digitalRead(buttonPin) == HIGH)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
pinMode(buttonPin, OUTPUT);
digitalWrite(buttonPin, HIGH);
pinMode(buttonPin, INPUT);
}
}