16 Create a function that toggles the LED on and off

Edit the function toggleLED.m so that it toggles the state of the LED connected to digital output 0. This function is a bit unusual in that it has no inputs and has no outputs.

To get the state of the LED use the function isDigitalOutputOn; see the help documentation for how this function works.

16.1 Test your function

Test your function by repeatedly typing the following into the Command Window:

toggleLED()

If your circuit is assembled correctly then the LED should turn on if it is currently off and it should turn off if it is currently on.