To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 569
568  |  570
Subject: 
Re: Need help to put sound in Minerva Program.
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Mon, 1 May 2000 18:04:43 GMT
Viewed: 
5101 times
  
Many Thanks to you Jonathan. This will help a great deal with this project.

--
Bob Fay
rfay@we.mediaone.net

The Shop
http://www.geocities.com/Heartland/Bluffs/7900/
"Jonathan Knudsen" <jonathan@oreilly.com> wrote in message
news:390D8A8D.11A2B9A6@oreilly.com...
> Hi Bob,
> 
> I've attached a modified version of the Minerva program. It plays
> different sounds for each of the following events:
> 
> 1. Moving forward : ascending arpeggio
> 2. Turning around : descending arpeggio
> 3. Found something to pick up : deedle-deedle
> 
> I'm sure you'll be able to modify these as you see fit.
> 
> Regards,
> Jonathan
> 
> -----
> #define TURNAROUND_TIME 425
> 
> int i;
> 
> task main() {
>   // Arm limit sensor and grabber light sensor.
>   SetSensor(SENSOR_3, SENSOR_LIGHT);
>   SetPower(OUT_A + OUT_C, OUT_FULL);
> 
>   calibrate();
>   i = 0;
>   while (i < 5) {
>     retrieve();
>     i += 1;
>   }
>   Off(OUT_A + OUT_C);
> }
> 
> #define NUMBER_OF_SAMPLES 10
> int runningTotal;
> int threshold;
> 
> sub calibrate() {
>   // Take an average light reading.
>   i = 0;
>   runningTotal = 0;
>   while (i < NUMBER_OF_SAMPLES) {
>     runningTotal += SENSOR_3;
>     Wait(10);
>     i += 1;
>   }
>   threshold = runningTotal / NUMBER_OF_SAMPLES;
> }
> 
> void grab() {
>   // Run the motor until we hit the limit switch.
>   OnFwd(OUT_A);
>   until (SENSOR_3 == 100);
>   // Back off from the switch.
>   OnRev(OUT_A);
>   until (SENSOR_3 != 100);
>   Off(OUT_A);
> }
> 
> void release() {
>   // Run the motor until we hit the limit switch.
>   OnRev(OUT_A);
>   until (SENSOR_3 == 100);
>   // Back off from the switch.
>   OnFwd(OUT_A);
>   until (SENSOR_3 != 100);
>   Off(OUT_A);
> }
> 
> int returnTime;
> 
> sub retrieve() {
>   // Drive forward until we see something.
>   OnFwd(OUT_C);
>   PlaySound(SOUND_UP);
>   ClearTimer(0);
>   until (SENSOR_3 < threshold - 3);
>   // Play a sound to signal we've found something.
>   PlayTone(660, 10);
>   PlayTone(494, 10);
>   PlayTone(660, 10);
>   PlayTone(494, 10);
>   PlayTone(660, 10);
>   PlayTone(494, 10);
>   Wait(20); // Move up on it a little.
>   returnTime = Timer(0);
>   Off(OUT_C);
> 
>   grab();
> 
>   // Turn around (roughly).
>   OnRev(OUT_C);
>   PlaySound(SOUND_DOWN);
>   Wait(TURNAROUND_TIME);
> 
>   // Drive back.
>   OnFwd(OUT_C);
>   PlaySound(SOUND_UP);
>   ClearTimer(0);
>   until (Timer(0) >= returnTime);
>   Off(OUT_C);
> 
>   release();
> 
>   // Turn around.
>   OnRev(OUT_C);
>   PlaySound(SOUND_DOWN);
>   Wait(TURNAROUND_TIME);
> }
> -----



Message is in Reply To:
  Re: Need help to put sound in Minerva Program.
 
Hi Bob, I've attached a modified version of the Minerva program. It plays different sounds for each of the following events: 1. Moving forward : ascending arpeggio 2. Turning around : descending arpeggio 3. Found something to pick up : deedle-deedle (...) (27 years ago, 1-May-00, to lugnet.robotics.rcx.nqc)

4 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

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