#define led_pin 2 // Arduino number | ATtiny PA02 #define button_pin 23 // Arduino number | ATtiny PA23 int button_state = 0; void setup() { // Initialize serial communications at 9600 bps // Only used for debug // Serial.swap(1); // Serial.begin(9600); // while(!Serial); // Initialize the LED pin as an output pinMode(led_pin, OUTPUT); // Initialize the button pin as an input pinMode(button_pin, INPUT); }// void setup void loop() { // Read the state of the pushbutton value // If it is pressed the button_state is LOW // When the button is open (unpressed) there is no connection between the two // legs of the button, so the pin is connected to 5V and we read a HIGH. button_state = digitalRead(button_pin); // Check if the button is pressed if (button_state == HIGH) { digitalWrite(led_pin, HIGH); } else { digitalWrite(led_pin, LOW); }//else //Only used for debug // Serial.print(button_state); }// void loop