To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 13259
13258  |  13260
Subject: 
Re: Charge!
Newsgroups: 
lugnet.robotics.rcx, lugnet.robotics
Date: 
Sat, 25 Nov 2000 19:44:06 GMT
Viewed: 
57 times
  
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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR