The Arduino is a little programmable doo-hickie that can be used for lots of things. I was playing with mine recently and hooked the digital outs up to an analog sound board. This is a common thing to do with the Arduino. You can coax the thing into making analog-like sounds through the digital output. Since it is digital, everything is a square wave.
All of these sounds were made with a little routine I got from the sample code for making a sound:
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}
Here are a few little audio samples that I made tonight whilst fooling around. The first one is just random frequencies:
long i = 0; i= random(5, 100); playTone( i*i, 100 );
The rest are just a sweep using different durations:
for(int i = 5; i < 100; ++i ) {
playTone( i*i, 50 );
}
for(int i = 100; i >= 5; --i ) {
playTone( i*i, 50 );
}
It has digital and analog inputs as well, so my next goal is to use some sort of control voltage to make noises. More to come!
M.
