Musik-Tanz-Programm - der Quelltext
Der Quelltext
#define __NOTETIME 10
#define __WAITTIME 12
void Melody1(){
PlayTone(262,4**__NOTETIME); Wait(4**__WAITTIME);
PlayTone(277,4**__NOTETIME); Wait(4**__WAITTIME);
PlayTone(294,4**__NOTETIME); Wait(4**__WAITTIME);
PlayTone(440,4**__NOTETIME); Wait(4**__WAITTIME);
PlayTone(466,4**__NOTETIME); Wait(4**__WAITTIME);
PlayTone(494,4**__NOTETIME); Wait(4**__WAITTIME);
}
void Back( int z){
On(OUT_A + OUT_C);
Rev(OUT_A + OUT_C);
Wait(z);
Rev(OUT_A + OUT_C);
}
void Drehen( int x){
OnFwd(OUT_A);
Off(OUT_A);
Wait(x);
On(OUT_A);
}
void Stop(){
Off(OUT_A);
Off(OUT_C);
}
void Run(int y){
OnFwd(OUT_A + OUT_C);
Wait(y);
}
task main() {
int X, Y, Z;
SetSensor(SENSOR_3,SENSOR_LIGHT);
SetSensor(SENSOR_1,SENSOR_TOUCH);
while(true) {
X = 100;
Run(X);
if (SENSOR_3 > 70) {
Stop();
Melody1();
ClearSensor(SENSOR_3);
}
X = 50;
Drehen(X);
if (SENSOR_3 > 70) {
Stop();
Melody1();
ClearSensor(SENSOR_3);
}
Z = 70;
Back(Z);
if (SENSOR_3 > 70) {
Stop();
Melody1();
ClearSensor(SENSOR_3);
}
X = 130;
Drehen(X);
if (SENSOR_3 > 70) {
Stop();
Melody1();
ClearSensor(SENSOR_3);
}
}
}
~
Autorin / Autor: Wencke, Carina, Julia, Esther - Stand: 13. Juni 2001