Challenges to stretch your brain
Each challenge gives you a goal and some starter code. Try it yourself first, peek at a hint if you get stuck, then read the explanation to see the idea behind the solution.
Your maker points
0 of 90 points · 0 of 5 challenges done
Blink an LED in a Pattern
Goal: Make a single LED blink the SOS signal: three short flashes, three long flashes, three short flashes, then a two second pause before repeating.
const int LED = 13;
void setup() {
pinMode(LED, OUTPUT);
}
void blink(int onTime, int times) {
// your code here
}
void loop() {
// three short, three long, three short
}Build a Reaction-Time Game
Goal: After a random wait of 2 to 6 seconds, light an LED. Measure how many milliseconds pass before the player presses the button, and print the score to the Serial Monitor. Catch cheaters who press early.
const int LED = 9;
const int BUTTON = 2;
void setup() {
pinMode(LED, OUTPUT);
pinMode(BUTTON, INPUT_PULLUP);
Serial.begin(9600);
randomSeed(analogRead(A0));
}
void loop() {
// 1. wait a random time
// 2. light the LED and remember millis()
// 3. wait for the press and print the difference
}Move a Servo to Different Angles
Goal: Sweep a servo smoothly from 0° to 180° and back, then make it pause for one second at 0°, 45°, 90°, 135° and 180° on the way.
#include <Servo.h>
Servo arm;
void setup() {
arm.attach(9);
}
void loop() {
for (int angle = 0; angle <= 180; angle++) {
arm.write(angle);
delay(15);
// pause at each checkpoint
}
}Create a Temperature Warning System
Goal: Read a temperature sensor and show three states with LEDs: green below 25 °C, yellow between 25 and 30, red plus a buzzer above 30. The system must not flicker when the temperature sits right on a boundary.
const int SENSOR = A0;
const int GREEN = 5, YELLOW = 6, RED = 7, BUZZER = 8;
bool alarmOn = false;
float readCelsius() {
float volts = analogRead(SENSOR) * 5.0 / 1024.0;
return (volts - 0.5) * 100.0;
}
void loop() {
float t = readCelsius();
// choose a state, then apply hysteresis to the alarm
}Make an Ultrasonic Sensor Detect Objects
Goal: Measure distance with an HC-SR04 and make a buzzer beep faster the closer an object gets — like a car parking sensor. Below 10 cm the tone should become continuous.
const int TRIG = 10, ECHO = 9, BUZZER = 8;
int distance() {
digitalWrite(TRIG, LOW); delayMicroseconds(2);
digitalWrite(TRIG, HIGH); delayMicroseconds(10);
digitalWrite(TRIG, LOW);
return pulseIn(ECHO, HIGH) * 0.034 / 2;
}
void loop() {
int d = distance();
// map distance to beep speed
}Finished them all?
Invent your own challenge, build it, and show it off to the community.
Share your build