|
Hello,
The sequence actually starts on the G, like this:
PlayTone(392, EIGHTH);
PlayTone(523, EIGHTH);
PlayTone(659, EIGHTH);
PlayTone(784, EIGHTH * 2);
PlayTone(659, EIGHTH);
PlayTone(784, EIGHTH * 2);
A reasonable value for EIGHTH is 16.
Regards,
Jonathan
P.S. I didn't actually test this code in NQC, but am pretty sure it will
work. I tested in leJOS as follows:
-----
import josx.platform.rcx.*;
public class ChargeSong {
private static final int EIGHTH = 16;
public static void main(String[] args) {
PlayTone(392, EIGHTH);
PlayTone(523, EIGHTH);
PlayTone(659, EIGHTH);
PlayTone(784, EIGHTH * 2);
PlayTone(659, EIGHTH);
PlayTone(784, EIGHTH * 2);
Wait(8 * EIGHTH);
}
public static void PlayTone(int frequency, int duration) {
Sound.playTone(frequency, duration);
}
public static void Wait(int hundreths) {
try { Thread.sleep(hundreths * 10); }
catch (InterruptedException ie) {}
}
}
-----
|
|
Message is in Reply To:
| | Re: Charge!
|
| (...) I don't think Dave is exactly right, but it is close. (I tested it on my panio.) I believe though that it repeats twice, one octave higher each time. Hope that helps! Cheers, (24 years ago, 24-Nov-00, to lugnet.robotics.rcx, lugnet.robotics)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|