One Button Simon: Difference between revisions
No edit summary |
(→Step 2) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
To start, the idea is to record a sequence of button presses (and releases) and have the arduino play back the pattern on the speaker. | |||
== Exercise == | == Exercise == | ||
Create a program to time how long the user presses a push button. | Create a program to time how long the user presses a push button. | ||
== Step 1 == | |||
Starting code / circuit: | Starting code / circuit: | ||
http://arduino.cc/en/Tutorial/Button | http://arduino.cc/en/Tutorial/Button | ||
Make sure your pushbutton circuit is working. | |||
== Step 2 == | |||
The following pieces will be useful. | |||
Print out a message (to the compute, use the Arduino Serial Monitor): | |||
<source lang="c"> | |||
Serial.println("hello"); | |||
</source> | |||
Get the current time(in milliseconds): | |||
<source lang="c"> | |||
s = millis(); | |||
</source> | |||
== Exercise == | == Exercise == | ||
== Exercise == | == Exercise == | ||
Write code to translate the presses from the user to a fixed pattern | Write code to translate the presses from the user to a fixed pattern |
Latest revision as of 15:26, 9 November 2010
To start, the idea is to record a sequence of button presses (and releases) and have the arduino play back the pattern on the speaker.
Exercise
Create a program to time how long the user presses a push button.
Step 1
Starting code / circuit:
http://arduino.cc/en/Tutorial/Button
Make sure your pushbutton circuit is working.
Step 2
The following pieces will be useful.
Print out a message (to the compute, use the Arduino Serial Monitor):
Serial.println("hello");
Get the current time(in milliseconds):
s = millis();
Exercise
Exercise
Write code to translate the presses from the user to a fixed pattern