const int buttonPin = 4;
const int circuitPin = 9;
int HasBeenSwitchedOn = 0;
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(circuitPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
digitalWrite(circuitPin, LOW);
} else {
if (HasBeenSwitchedOn == 0) {
digitalWrite(circuitPin, HIGH);
HasBeenSwitchedOn = 1;