Subject:
|
Re: sensor-defined variable
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Wed, 13 Apr 2005 12:07:08 GMT
|
Viewed:
|
1258 times
|
| |
| |
In lugnet.robotics, roc j de cisneros wrote:
> i tested your example, just to try, and i get compiler errors:;
>
> PlayTone(SENSOR_1*10,5); ^^
>
> what's wrong with 10?
Nothing is wrong with 10, it was my assumption that was wrong. There are more
than one version of the LEGO firmware, and it appears you have an older version
that does not allow variable frequencies (the frequency must be a constant). Try
this:
task main()
{
int i;
SetSensor(SENSOR_1,SENSOR_LIGHT);
i=SENSOR_1;
while(true)
{
if(SENSOR_1>i)
PlayTone(440,5);
else
PlayTone(880,5);
Wait(5);
}
}
That will set up the light sensor & take a single reading. If the light sensor
return is above the intial reading, it will play one tone, if it is below it, it
will play a second tone.
If you can, upgrade to the newest firmware - it is availible from the LEGO
2.0 SDK if memory serves (can't remember where to download it - anyone?).
--
Brian Davis
|
|
Message is in Reply To:
| | sensor-defined variable
|
| hi again i tested your example, just to try, and i get compiler errors:; PlayTone(SENSOR_1*10,5); ^^ what's wrong with 10? what am i missing? thanks r (...) (20 years ago, 13-Apr-05, to lugnet.robotics)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|