Acadia Lab 228 + Lab 222

时间:2023-02-08 12:27:38

又是一对串烧实验,布好线后非常方便就可以一起完成。

连线方案一模一样:

Acadia Lab 228 + Lab 222

Acadia Lab 228 + Lab 222

Lab 228 数码管骰子

核心代码如下:

def loop() :
global cnt
global btn_read,sec,on gpio.digital_write(channel[8],LOW)
gpio.digital_write(channel[9],LOW)
gpio.digital_write(channel[10],LOW)
gpio.digital_write(channel[11],HIGH)
display_digit(digit1)
delay(5)
cnt=cnt+5 btn_read=gpio.digital_read('gpio1')
if btn_read==1:
delay(20)
btn_read=gpio.digital_read('gpio1')
if btn_read ==1:
if on==1:
print("warning: stop here!")
on=0
else :
print("game begins!")
on=1 if cnt>=100 and on==1 :
cnt=0
get_digit()

视频地址如下:

http://v.youku.com/v_show/id_XMTI2MzM4NDk4MA==.html

Lab 222 秒表

核心代码如下:

gpio.digital_write(channel[8],HIGH)
gpio.digital_write(channel[9],LOW)
gpio.digital_write(channel[10],LOW)
gpio.digital_write(channel[11],LOW)
display_digit(digit4)
delay(5)
cnt = cnt + 5 gpio.digital_write(channel[8],LOW)
gpio.digital_write(channel[9],HIGH)
gpio.digital_write(channel[10],LOW)
gpio.digital_write(channel[11],LOW)
display_digit(digit3)
delay(5)
cnt=cnt+5 gpio.digital_write(channel[8],LOW)
gpio.digital_write(channel[9],LOW)
gpio.digital_write(channel[10],HIGH)
gpio.digital_write(channel[11],LOW)
display_digit(digit2)
gpio.digital_write(channel[2],LOW)
delay(5)
cnt=cnt+5 gpio.digital_write(channel[8],LOW)
gpio.digital_write(channel[9],LOW)
gpio.digital_write(channel[10],LOW)
gpio.digital_write(channel[11],HIGH)
display_digit(digit1)
delay(5)
cnt=cnt+5

视频地址如下:

http://v.youku.com/v_show/id_XMTI2MTE4MzAwNA==.html?f=25838393

唯一能说一说的经验就是:一般显示错误都是连线没连好(大雾)

我特么就是某个横杠一直显示不对,改了半天代码,最后换了根线就好了,(╯‵□′)╯︵┴─┴