{ BrainPad.TrafficLight.TurnRedLightOn(); } else { BrainPad.TrafficLight.TurnRedLightOff(); } Example 11 This code turns the red light on if the frequency is greater than 6,000, otherwise – it turns it off. Pressing the up button will increase the frequency. Once the frequency is greater than 6,000 the red light will turn on. Exercise Add a variable that starts at 0 and increments by 1 every loop. Once the variable reaches 1,000 turn the yellow light on. Print the variable value in the Output Window to make sure it’s incrementing. Verify the yellow light comes on when the variable goes over 1,000.
{ BrainPad.TrafficLight.TurnRedLightOn(); } else { BrainPad.TrafficLight.TurnRedLightOff(); } Example 11 – This code turns the red light on if the frequency is greater than 6,000, otherwise it turns it off. Pressing the up button will increase the frequency. Once the frequency is greater than 6,000 the red light will turn on. Exercise Add a variable that starts at 0 and increments by 1 every loop. Once the variable reaches 1,000 turn the yellow light on. Print the variable value in the Output Window to make sure it’s incrementing. Verify the yellow light comes on when the variable goes over 1,000.
BrainPad_CS_VariablesAndNestedStatements.docx