Been trying to find a few ways to control one Arduino with another Arduino wirelessly. Bluetooth is one option but it can be difficult to set up and pair 2 devices. Radio control is another – simply use an Arduino to transmit a signal and have the other Arduino receive it.
This shows how the system works. It’s quick and very responsive.
Following on from my adventures with the PS2 keyboard, I modified the code to play tones.
What I like about this is the opportunity to work with arrays. The “FOR” section is key. It scans an array to see if there is a match with the pressed key. If there’s a match, it then uses the position of the array to get the frequency and play it.
A noisy lesson – take a couple of speakers and get them to play a frequency. The frequency range is about 30 hertz to 20,000 hertz. As you get older, the top level you can hear goes down. I like this lesson as it teaches some key words such as frequency, tone, pitch and vibration. It also builds up into teaching the idea of variables as well as functions. Plus it teaches music.
The basic code for Arduino:
tone (10,500); // 10 is the speaker pin, 500 is the frequency.
Easy to pick up. Here’s an example.
It’s just tones at the moment. We can use this to make music as well.
The basic principle of a light alarm is to measure any changes in the light levels. If the level goes above or below a certain level, something is triggered.
I like this because it teaches variables and responding to a change in that variable.
FOREVER measure the light level
IF the level changes, do something.
You can even use the > and < signs to extend it. The circuit is very simple – a light dependant resistor, 10k resistor , 3 wires and an Arduino. You can add more OUTPUTS or use Scratch on screen to do something.
This is an example of Scratch reacting – by 10 and 11 year olds.
RGB LEDs are great. They can produce a range of colours depending on the amount of power give to each LED bulb. Once you have access to the colour codes, you can produce 256 x 256 x 256 colours. Which is a lot of combinations.
We use Scratch For Arduino. This allows you to easily edit the analog power outputs. Put in a delay and a repeat and you’ve got a disco. As it’s Scratch based, it’s easy to do for primary children.