407c649539e1c85e5f65b37925ff2e75e9228fa6
2 This program is free software: you can redistribute it and/or modify
3 it under the terms of the GNU Affero General Public License as
4 published by the Free Software Foundation, either version 3 of
5 the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU Affero General Public License for more details.
12 You should have received a copy of the GNU Affero General Public License
13 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // pin 13 controls the arduino's built-in LED
18 // connect the button to pin 2
20 // initially, the button is not pressed.
21 // 0 means not pressed, 1 means pressed
28 // see if you can figure out how this logic works
29 if(digitalRead(button_pin
) != button_value
){
30 Serial
.println("button state changed!");}
31 // read the value of the button pin during this loop,
32 // and save it in a box named "button_value"
33 button_value
= digitalRead(button_pin
);
34 // write the value to the led pin
35 digitalWrite(led_pin
, button_value
);}