From 3eece29807f5257091271229dbf41543646eb4e4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 4 Jun 2015 23:53:26 +0100 Subject: docs: Change "Micro Python" to "MicroPython" in all places in docs. --- docs/pyboard/tutorial/leds.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/pyboard/tutorial/leds.rst') diff --git a/docs/pyboard/tutorial/leds.rst b/docs/pyboard/tutorial/leds.rst index 2105580e8..763eedf01 100644 --- a/docs/pyboard/tutorial/leds.rst +++ b/docs/pyboard/tutorial/leds.rst @@ -44,7 +44,7 @@ Next we will set up an infinite loop that cycles through each of the LEDs turnin Here, n keeps track of the current LED and every time the loop is executed we cycle to the next n (the % sign is a modulus operator that keeps n between 0 and 3.) Then we access the nth LED and toggle it. If you run this you should see each of the LEDs turning on then all turning off again in sequence. -One problem you might find is that if you stop the script and then start it again that the LEDs are stuck on from the previous run, ruining our carefully choreographed disco. We can fix this by turning all the LEDs off when we initialise the script and then using a try/finally block. When you press CTRL-C, Micro Python generates a VCPInterrupt exception. Exceptions normally mean something has gone wrong and you can use a try: command to "catch" an exception. In this case it is just the user interrupting the script, so we don't need to catch the error but just tell Micro Python what to do when we exit. The finally block does this, and we use it to make sure all the LEDs are off. The full code is:: +One problem you might find is that if you stop the script and then start it again that the LEDs are stuck on from the previous run, ruining our carefully choreographed disco. We can fix this by turning all the LEDs off when we initialise the script and then using a try/finally block. When you press CTRL-C, MicroPython generates a VCPInterrupt exception. Exceptions normally mean something has gone wrong and you can use a try: command to "catch" an exception. In this case it is just the user interrupting the script, so we don't need to catch the error but just tell MicroPython what to do when we exit. The finally block does this, and we use it to make sure all the LEDs are off. The full code is:: leds = [pyb.LED(i) for i in range(1,5)] for l in leds: -- cgit v1.2.3