Programming is fun, but when you can use it to control the physical world around you - it is exciting!
When a LED blinks based on code that you have written, it is magical.
Building circuits on breadboards, and programming them using the Arduino
Starting in 2013, all 6th graders in the Los Altos school district CSTEM program learn to build simple circuits on breadboards and program LEDs, and buzzers using the Arduino.
- What are the elements of a simple circuit - a simple introduction to Ohms law.
- What is a breadboard, and how does it work
- What is an Arduino - understanding some basic vocabulary - analog, digital, ground, USB cable etc.
- Understanding how to use the Arduino IDE and to download code.
- Creating a basic circuit using just one LED and resistor and a breadboard, and changing the blink pattern
- Creating a more complex circuit with multiple LEDs, buzzer and projects that include Morse code, music notes etc.
Sample Arduino lesson: Music Light Box.
- Lesson Plan PDF
- Student Instructions PDF
- My project is not working ! Student Debug instructions document
- Basic code for the Music light box project.
Arduino Robots built as a pilot program with Khan Academy
In 2012-2013 school year, Santa Rita sixth graders built robots in the Science class and they had to understand how to program them. This was done as a pilot program with Khan Academy and I helped with the building process and also in explaining the programming of the Arduinos.
Some more sample programs
Green Light Red Light (go as straight as possible when light is green, when it stops light turns red)
Fade Spider's Green Eye (Green color on one LED is on pin 3 - this one allows analogWrite so you can fade it by giving different values)
Color Only - test all RGB colors on both Spider's eyes (run all RGB colors and mixes in each eye)
In the code loop, you will want to do one of these
- Turn robot eye LED to different colors
- LEDs are digital output pins so you can turn them on or off, use HIGH or low. Remember the RGB color mixing we did in class
- digitalWrite(Red_Eye_Left, HIGH); //turns on left eye red LED.
- Control robot left or right motors - in forward or reverse mode using a value.
- This is an analog output, it can have different values. 0 = turn it off
- analogWrite(Right_Reverse, 90); //run right motor backwards
- Add a delay - do a wait between operations so you can see what is going on or to make it blink..
- delay(500); //wait for half a second
If your LED colors are different, remember to check your pin defines in the code, change it in the code to make it work.
You do not need to re-do your robot.