[ESP32+MicroPython]快速接入blinker
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from machine import Pin
from Blinker.Blinker import Blinker, BlinkerButton, BlinkerNumber
from Blinker.BlinkerDebug import *
auth = 'Your Device Secret Key'
ssid = 'Your WiFi network SSID or name'
pswd = 'Your WiFi network WPA password or WEP key'
BLINKER_DEBUG.debugAll()
Blinker.mode('BLINKER_WIFI')
Blinker.begin(auth, ssid, pswd)
button1 = BlinkerButton('btn-abc')
number1 = BlinkerNumber('num-abc')
counter = 0
pinValue = 0
p2 = Pin(2, Pin.OUT)
p2.value(pinValue)
def button1_callback(state):
''' '''
BLINKER_LOG('get button state: ', state)
button1.icon('icon_1')
button1.color('#FFFFFF')
button1.text('Your button name or describe')
button1.print(state)
global pinValue
pinValue = 1 - pinValue
p2.value(pinValue)
def data_callback(data):
global counter
BLINKER_LOG('Blinker readString: ', data)
counter += 1
number1.print(counter)
button1.attach(button1_callback)
Blinker.attachData(data_callback)
if __name__ == '__main__':
while True:
Blinker.run() from Blinker.Blinker import Blinker, BlinkerButton, BlinkerNumber 出错,memoryerror:memory allocation failed,allocation个136bytes,怎么破? 快速接入blinker www.tdszx.comwww.jyhxjm.comwww.gztpcj.com 请问大神:我用的mincropython IDE是uPyCcaft,不知道如何安装blinker-mpy-master 库。查遍网络,找不到一篇文章讲解,请教大神指导 也用thonny IDE,但还是无法安装blinker-mpy-master库
页:
[1]