Paso 3: código
// Edison Relay Basicconst int buttonPin = 3; // the button is attached to digital pin 3 const int relayPin = 6; // the relay is attached to digital pin 9
int buttonState = 0;
void setup() { pinMode(relayPin, OUTPUT); pinMode(buttonPin, INPUT); }
boolean released = false; void loop() { // read the state of the button: buttonState = digitalRead(buttonPin); if (buttonState == 1) { if(released == true) { digitalWrite(relayPin, HIGH); released = false; } } else { if(released == false) { digitalWrite(relayPin, LOW); released = true; } } }