Arduino Challenges
Please save every code you write here by its challenge name.
For example, for Challenge1.1 - LED blink, your code should be named:
Challenge1.1_LED_blink.ino.
All codes are to be submitted in the Google Classroom assignments section.
Arduino Challenges
Challenge 1.1 - LED Blink
Your objective is to add a second LED, then modify your lesson 1 code on the Arduino so that 2 LEDs turn on/off at the same time, i.e.:
(1 second on, 1 second off, in a loop)
Challenge 1.2 - LED Blink
Your objective is to modify your C1.1 code so that your two LEDs alternately flash, i.e.:
(LED 1 on, LED 1 off, LED 2 on, LED 2 off, in a loop)
Activity 1 - Using a Multimeter
Challenge 2 - LED Trailing Effects
Recall what you learned from Lesson 1.
Your objective is to try to rewrite Lesson 2 code without the use of a for-loop that has the same effect.
The goal of this challenge is for you to appreciate the use of “for-loops”.
Challenge 3 - Traffic Lights
Your objective is to create 2 sets of traffic lights on opposite sides of your breadboard to act as "an intersection"
Program the traffic lights to light up following a U.S. traffic light pattern:
When one side is green, the other side should be red.
Similarly, when one side is red, the other side should be green.
Keep in mind that in the U.S., yellow only happens from Green to Red.
From Red to Green, there is no yellow.
Challenge 4 - Analog Input (Potentiometer)
Your objective is to connect 4 LEDs to be turned on based on your potentiometer values.Â
Split the potentiometer values into 4 categories:
1-255, 256-511, 512-767, 768-1023
When the value is between 1 and 255, turn on led1.
When the value is between 256 and 511, turn on led2. (led 1 stays on)
When the value is between 512 and 767, turn on led3. (led 1,2 stay on)
When the value is between 768 and 1023, turn on led4. (led 1,2,3 stay on)
When the value is 0 (no leds are on)
You will need to use the famous if-else if-else statement, as well as the "and" syntax:
and &&
or ||
not !
Your if/else if/else statements should look somewhat similar to the below example:
  if (value > 0 && value < 256) {
    ...
  }
Challenge 5 - Buttons
Your objective is to use two buttons.
One to turn on an LED, the other to turn off the same LED.
Challenge 6 - Fading
Your objective is to use a potentiometer to control the brightness of an LED. (Recall Lesson 4).
You will need to use the map() function. Since LED analog values are between 0-255, but a potentiometer value ranges between 0-1023. That is, a value of fromLow (0) would get mapped to toLow (0), a value of fromHigh (255) to toHigh (1023), values in-between to values in-between, etc.
(Kind of like a ratio from Algebra)
Challenge 7 - Responder Experiment
No challenge is available for Lesson 7, since the lesson itself is already hard enough.
Challenge 8 - Active Buzzer
Your objective is to use a button to control the active buzzer.
The buzzer will only turn on when a button is pressed.
Activity 1 - Morse Code
Communicating in a coded way, besides being so fascinating, has many applications in various fields. One of the most common methods of code communicating is Morse code. In this tutorial, you’ll learn how to make an interpreter to send and receive Morse code with Arduino.
Although Morse code is not used as much as the past anymore, it still has its own applications. Morse code is still popular among enthusiasts in the field of amateur radios. Morse code is also used in aeronautical navigation systems. Many ships use Morse code to send light for communication or help. Also, those who can not talk for any reason can also use Morse code to express their meaning.
And besides all, learning and using Morse code to communicate can be fun and entertaining.
Your first activity would be to decipher each other's messages via Morse Codes.
Challenge 9.1 - Passive Buzzer
Your objective is to control the buzzer frequency using a potentiometer.Â
A map() function is needed here again.
While a passive buzzer is able to output tens of thousands of different frequencies that human ears can hear, we only really need the range from the below table. Create a map from the buzzer (523 Hz to 1046 Hz) into a potentiometer (1 to 1023)
Do (C) 523 Hz
C sharp 554 Hz
Re (D) 587 Hz
D sharp 622 Hz
Mi (E) 659 Hz
Fa (F) 698 Hz
F sharp 740 Hz
Sol (G) 784 Hz
G sharp 831 Hz
La (A) 880 Hz
A sharp 932 Hz
Si (B) 988 Hz
Do (C) 1046 Hz
For a harder challenge (if interested), set up a kill switch when the potentiometer is at value 0 (far left position), using an if/else statement, so the buzzer doesn't make any sound until you start rotating the potentiometer.
Use:
noTone(buzzer);Â to turn off the buzzer
Challenge 9.2 - Passive Buzzer
Your objective is to create a simple "piano" with up to 8 switches to play the 8 basic notes (Provided there are enough switches for everyone to use):
Do (C) 523 Hz
Re (D) 587 Hz
Mi (E) 659 Hz
Fa (F) 698 Hz
Sol (G) 784 Hz
La (A) 880 Hz
Si (B) 988 Hz
Do (C) 1046 Hz
Activity 2 - Music Time!
Your objective is to create a piece of simple music! (Make it last at least 15 seconds and should be recognizable by other people)Â
Some Notes that could be useful:
Do (C) 523 Hz
C sharp 554 Hz
Re (D) 587 Hz
D sharp 622 Hz
Mi (E) 659 Hz
Fa (F) 698 Hz
F sharp 740 Hz
Sol (G) 784 Hz
G sharp 831 Hz
La (A) 880 Hz
A sharp 932 Hz
Si (B) 988 Hz
Do (C) 1046 Hz
Challenge 10 - RGB LED
Your objective is to use for-loops again for a smooth color transition.
Instead of changing from red directly to green, try to use for-loops so that the color transitions in 255 steps from red to green gradually.
Challenge 11 - Making sounds with a Photoresistor
Your objective is to add a LED that changes brightness (Recall Lesson 4) right next to your photoresistor, then modify your code so that the buzzer automatically adjusts its pitch based on the brightness of the LED.
Challenge 12 - Analog Temperature (Need thermometers)
Your objective is to convert the analog thermistor values to Fahrenheit, then have your serial monitor display Fahrenheit instead.
You will have to measure two data points between the thermistor value and actual Fahrenheit degrees.
Then, we can use another equation to display Celsius as well.
This challenge is more a math/science lab than a programming challenge, though we will still need to do some programming.
Challenge 13 - Tilt Switch
No challenge is available for Lesson 13, because I simply can not think of anything that a tilt switch can be applied to nowadays in the 21st century, it's essentially the same as a regular power switch.
Instead of completing a challenge, just read this webpage so you know exactly what's going on inside a tilt switch.
Challenge 14 - Eight LEDs and a Shift Register
No challenge is available for Lesson 14, since the lesson itself is already hard enough.
Challenge 15 - One Digit LED Segment Display
Your objective is to connect a passive buzzer to work with the Segment display, somewhat like a "countdown".
As the countdown digit gets smaller and smaller (9, 8, 7, 6, 5, 4, 3, 2, 1), your buzzer makes higher pitches. I can't use the b-word, but you get the idea of what you are trying to achieve for this challenge.
Challenge 16 - Four Digit LED Segment Display
Definitely no challenge for Lesson 16, since the lesson itself is already hard enough.
Challenge 17 - DC Motor
Your objective is to control the DC Motor speed via a potentiometer.
Challenge 18 - Sweep (Servo)
(No programming) Your objective is to take apart a servo and analyze the internals of what's going on inside a servo, and put it back together (important!) to make sure it still works.
Challenge 19.1 - Servo
Your objective is to control a servo using 2 buttons.Â
When first button is pressed & held, servo will go to position 0 (far left).
When second button is pressed & held, servo will go to position 180 (far right).
When neither button is pressed & held, servo will stay at position 90 (center).
Challenge 19.2 - Servo
Similar to Challenge 19.1, your objective is to control a servo using 2 buttons.Â
When first button is pressed, servo will go to position 0 (far left) and stay at position 0.
When second button is pressed, servo will go to position 180 (far right) and stay at position 180.
Challenge 20 - One Step at a Time
No challenge is available for Lesson 20, since the lesson itself is pretty straight forward.
Challenge 21 - Stepper Speed Control
No challenge is available for Lesson 21, since the lesson itself is pretty straight forward.
Challenge 22.1 - Ultrasonic Ranging
Your objective is to convert the units of your Lesson 22Â and have your Arduino display inches (in), instead of centimeters (cm).
Challenge 22.2 - Ultrasonic Ranging
Your objective is to connect a buzzer that will go off when the ultrasonic sensor measures a distance that's less than 5 inches.
Challenge 23 - Infrared Remote Control Experiment
Your objective is to connect both an LED and a servo to be controlled via a remote.
Challenge 24 - DHT11 Experiment
Your objective is to convert the units of your Lesson 24 and have your Arduino display temperature units in Fahrenheit (F), instead of Celsius (C). No changes are needed for Humidity.
Challenge 25 - LCD1602
Your objective is to create a custom character using the character creator:
https://maxpromer.github.io/LCD-Character-Creator/
Then, figure out a way for your character to move from left to right side of the screen (in a loop).
Use this webpage for more information on creating custom characters:
https://www.arduino.cc/reference/en/libraries/liquidcrystal/createchar/
Challenge 26 - Temp & Humidity Monitoring
No challenge is available for Lesson 26, since the lesson itself is already hard enough.
Challenge 27 - Water Level Monitoring
Your objective is to add a water-level alarm so that when water levels reach above 80%, an active buzzer will go off.
Challenge 28 - Joystick Test Experiment
Your objective is to control a motor and a servo using a joystick.
Use the x-values (left and right) to control the servo.
Use the y-values (up) to control the motor.
(You do not need LCD 1602 connected)