coachoreo.blogg.se

Blink lite board make faster
Blink lite board make faster








Every time the loop runs it will run each instruction inside of it in order, so you can see how it starts by turning the LED on, then delaying a bit, turning the LED off, and delaying again. The value 10 means the loop should repeat 10 times, however you can increase or decrease this to control how many times the LED blinks. Likewise if you decrease it then the LED will blink faster.Īlso try changing the number in the range function call that starts the loop. If you increase the value the LED will stay on and off for longer periods and slow down the blinking. You can use decimal values like 0.5 to sleep for half a second. This function takes in a number that controls how long in seconds the board will delay.

Try entering the code again and changing the value of the time.sleep function calls. Only once the code stops running can MicroPython give you the prompt to enter more code. This is because MicroPython can only do one thing at a time and running code in a loop like that requires all of the board's attention. Notice as the LED blinks and the loop runs you can't see the > REPL prompt or enter any code. If your board doesn't have built-in LEDs make sure you've wired up a LED to one of the digital GPIO pins as shown in the previous page. Both the HUZZAH ESP8266 boards have a red LED you can control connected to pin number 0.Feather HUZZAH ESP8266 and HUZZAH ESP8266 Breakout.Instead of trying to send a number like 4 to pin functions you'll instead send a string 'B4'. Note too on the pyboard pin names are strings like 'B4' for the blue LED.So pin P2 is actually called B4, P3 is A15, etc. One important clarification though, when you reference those pins in code you want to use the 'CPU name' in the white box on the diagram and not the pin name in the yellow box.

blink lite board make faster

See the pinout diagram here and its note that pins P2-P5 control the LEDs. The pyboard has 4 built-in LEDs that you can control.

blink lite board make faster blink lite board make faster

If your board has built-in LEDs that you can control you'll want to note the pin names or numbers for the LEDs: This way we can interactively turn the LED on and off right from the board without uploading any code, sketches, etc. To blink the LED we'll connect to the MicroPython board's REPL (read-eval-print loop, like a Python 'command prompt') and run commands that control the digital GPIO connected to the LED.








Blink lite board make faster