// RCXVLL.nqh - Header file containing macros for sending VLL messages to the micro scout via an LED or some such light. // * * * * * * * * * * * * * * Need to add: Next, Stop, Reset // START UTILITY FUNCTIONS - Used to make up the other functions quickly void VLL1() { OnFor(VLL_OUT, 2); Wait(4); } void VLL0() { OnFor(VLL_OUT, 4); Wait(2); } void VLLStart() { Off(VLL_OUT); Wait(2); } void VLLEnd() { OnFor(VLL_OUT, 2); Wait(6); OnFwd(VLL_OUT); Wait(12); } // END UTILITY FUNCTIONS - START DIRECT FUNCTIONS void msFwd() { VLLStart(); VLL1();VLL1();VLL1(); // Checksum VLL0();VLL0();VLL0();VLL0();VLL0();VLL0();VLL0(); // Data VLLEnd(); } void msRev() { VLLStart(); VLL1();VLL1();VLL0(); VLL0();VLL0();VLL0();VLL0();VLL0();VLL0();VLL1(); VLLEnd(); } void msBeep1() // Beeps 1-5 are annoying beeping noises. If calling them directly, you'll have to wait for the noise to finish before sending the next command. { VLLStart(); VLL0();VLL1();VLL0(); VLL0();VLL0();VLL0();VLL0();VLL1();VLL0();VLL0(); VLLEnd(); } void msBeep2() { VLLStart(); VLL0();VLL0();VLL1(); VLL0();VLL0();VLL0();VLL0();VLL1();VLL0();VLL1(); VLLEnd(); } void msBeep3() { VLLStart(); VLL0();VLL0();VLL0(); VLL0();VLL0();VLL0();VLL1();VLL0();VLL0();VLL0(); VLLEnd(); } void msBeep4() { VLLStart(); VLL1();VLL0();VLL1(); VLL0();VLL0();VLL0();VLL0();VLL1();VLL1();VLL1(); VLLEnd(); } void msBeep5() { VLLStart(); VLL0();VLL0();VLL0(); VLL0();VLL0();VLL0();VLL0();VLL1();VLL1();VLL0(); VLLEnd(); } void msRunScript() // Runs the P script { VLLStart(); VLL1();VLL0();VLL0(); VLL0();VLL1();VLL0();VLL0();VLL0();VLL0();VLL1(); VLLEnd(); } void msDeleteScript() // Removed P script { VLLStart(); VLL0();VLL1();VLL1(); VLL0();VLL1();VLL0();VLL0();VLL0();VLL1();VLL0(); VLLEnd(); } // END DIRECT FUNCTIONS - START SCRIPTING FUNCTIONS void ms_Fwd05() // Fwd and Rev do just that - number is time. 05 = 0.5s, 10 = 1.0s { VLLStart(); VLL0();VLL1();VLL0(); VLL0();VLL0();VLL1();VLL0();VLL0();VLL0();VLL0(); VLLEnd(); } void ms_Fwd10() { VLLStart(); VLL0();VLL0();VLL1(); VLL0();VLL0();VLL1();VLL0();VLL0();VLL0();VLL1(); VLLEnd(); } void ms_Fwd20() { VLLStart(); VLL0();VLL0();VLL0(); VLL0();VLL0();VLL1();VLL0();VLL0();VLL1();VLL0(); VLLEnd(); } void ms_Fwd50() { VLLStart(); VLL1();VLL1();VLL1(); VLL0();VLL0();VLL1();VLL0();VLL0();VLL1();VLL1(); VLLEnd(); } void ms_Rev05() { VLLStart(); VLL1();VLL0();VLL1(); VLL0();VLL0();VLL1();VLL0();VLL1();VLL0();VLL0(); VLLEnd(); } void ms_Rev10() { VLLStart(); VLL1();VLL0();VLL0(); VLL0();VLL0();VLL1();VLL0();VLL1();VLL0();VLL1(); VLLEnd(); } void ms_Rev20() { VLLStart(); VLL0();VLL1();VLL1(); VLL0();VLL0();VLL1();VLL0();VLL1();VLL1();VLL0(); VLLEnd(); } void ms_Rev50() { VLLStart(); VLL0();VLL1();VLL0(); VLL0();VLL0();VLL1();VLL0();VLL1();VLL1();VLL1();VLL1(); VLLEnd(); } void ms_WaitForLight() // Waits for light before executing next statement { VLLStart(); VLL0();VLL1();VLL0(); VLL0();VLL0();VLL1();VLL1();VLL1();VLL0();VLL1(); VLLEnd(); } void ms_SeekLight() // Goes into the Seeklight program (MS Prog 3). If uninterrupted, comes out after 30 secs of inactivity. But if seeing light, it carries on indefinitely. { VLLStart(); VLL0();VLL0();VLL1(); VLL0();VLL0();VLL1();VLL1();VLL1();VLL1();VLL0(); VLLEnd(); } void ms_Code() // Goes into Code program (MS Prog 7) - if you get 3 codes wrong, it plays a sound, then continues with your program. If you get any of the codes right, it continues with your program. { VLLStart(); VLL0();VLL0();VLL0(); VLL0();VLL0();VLL1();VLL1();VLL1();VLL1();VLL1(); VLLEnd(); } void ms_KeepAlive() // Starts the 'keep alive' program (MS Prog 5 - picks up speed as light is flashed). Comes out of the program after 15 sec of inactivity { VLLStart(); VLL1();VLL0();VLL1(); VLL0();VLL1();VLL0();VLL0();VLL0();VLL0();VLL0(); VLLEnd(); } /*void ms_() { VLLStart(); VLLEnd(); } // Frame of a scripting function - I have not included the 5 beeps. You'll probably be listening to far more beeps than you really want to! */