Micropython TPYBoard V10X plug-in programming practice: Not proficient in timer code? ...
[Copy link]
For Micropython, code programming is an essential part, but for DIY enthusiasts, a huge audience, programming seems a bit difficult, after all, most people are not proficient in code. So is there a simpler way to program? Today I will introduce to you how to implement conventional code programming through puzzle pictures. Let's implement the simplest timer function. Use the timer of micropython to make the red LED flash once per second. Let’s first take a look at our puzzle programming interface: The left side is the directory bar, the middle white background is the puzzle drawing area, and the right side is the code display area. When we drag the corresponding graphic from the directory bar to the puzzle illustration area, the code display area will display the corresponding code, as shown in the figure: 1. Production process [p=30, null, To use the timer, you need to import the Timer library first. from pyb import Timer, you can use * instead. import pyb from pyb import * #Import library def test(returnValue):#Function definition [p=30, null,LED(1).toggle() LED(1).toggle() return t = Timer(1,freq=1,callback=test) #Define Timer: #Set Timer number #Set patrol time #Define frequency. The larger the number, the higher the frequency.
|