Code: #pragma config(Sensor, port1, redLED, sensorVexIQ_LED) #pragma config(Sensor, port2, yellow1LED, sensorVexIQ_LED) #pragma config(Sensor, port3, yellow2LED, sensorVexIQ_LED) #pragma config(Sensor, port4, greenLED, sensorVexIQ_LED) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task warningSound() { bPlaySounds = true; nVolume = 4;
TMusicalNotes nNoteToPlay = (3 << 4) + 5; //3rd Octave, Note 'E' playNote(nNoteToPlay, 30); //Play the note for 300ms
} task lightTree() { setTouchLEDColor(redLED, colorRedViolet); sleep(2000); setTouchLEDColor(redLED, colorNone);
setTouchLEDColor(yellow1LED, colorYellow); sleep(500); setTouchLEDColor(yellow1LED, colorNone);
setTouchLEDColor(yellow2LED, colorYellow); sleep(500); setTouchLEDColor(yellow2LED, colorNone);
setTouchLEDColor(greenLED, colorGreen); sleep(2000); setTouchLEDColor(greenLED, colorNone); }
task main() { while(true){ if(getJoystickValue(BtnRDown) == 1){ startTask(warningSound); startTask(lightTree); } } }
|