1398 views|0 replies

55

Posts

0

Resources
The OP
 

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.


 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list