Exercise 1
Exercise 1
EXECRCISE 2
Exerrcise 3
OBJECTIVES
Exercise 1 LED
Using Tinkercad circuits, create a circuit with arduino UNO, a breadboard, and a led connected to
Arduino digital pin
write down a program that makes the led blinks once per second.
The green light will be on 10s, then the yellow light will blink 10 times and then the red light
will be on 10s
write down a program that waits the user to push and then changes the state of the led
(on/off).
Code
// give it a name:
int pushButton = 2;
void setup() {
Serial.begin(9600);
pinMode(pushButton, INPUT);
pinMode(led, OUTPUT);
void loop() {
Serial.println(buttonState);
if (buttonState == 1) {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
} else {
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW