4、Blynk远程控制七彩灯

调整APP控制面板元素为

 

16.jpg

点赞  2020-6-9 09:46

#MicroPython动手做(30)——物联网之Blynk
#Blynk远程控制七彩灯RGB

 

#MicroPython动手做(30)——物联网之Blynk
#Blynk远程控制七彩灯RGB

from mpython import *
import network
import music
import blynklib
import time

my_wifi = wifi()

my_wifi.connectWiFi("zh", "zy1567")

blynk = blynklib.Blynk("CO1NhMoRAYxP3p3hBjvsqrrHmIoYzM0e", server="116.62.49.166", port=8080)

@blynk.handle_event("connect")
def connect_handler():
    print('Blynk connected')

@blynk.handle_event("disconnect")
def connect_handler():
    print('Blynk disconnected')

@blynk.handle_event('write V0')
def write_virtual_pin_handler(pin, _value):
    global my_list
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    my_list = _value
    rgb.fill( (int(my_list[0]), int(my_list[1]), int(my_list[2])) )
    rgb.write()
    time.sleep_ms(1)


music.play('G5:1')
oled.fill(0)
oled.DispChar("    远程控制七彩灯RGB", 0, 16, 1)
oled.show()
rgb[1] = (int(0), int(102), int(0))
rgb.write()
time.sleep_ms(1)
while True:
    blynk.run()

 

点赞  2020-6-9 13:34

mPython X 实验图形编程

 

17.png

点赞  2020-6-9 13:37

#MicroPython动手做(30)——物联网之Blynk
#Blynk远程控制七彩灯RGB

 

https://v.youku.com/v_show/id_XNDcwNTIxNjAzNg==.html

 


 

点赞  2020-6-9 15:53

5、远程网络八音盒电子琴

 

设置的APP控制面板元素为

 

18.jpg

 

 

点赞  2020-6-9 16:30

#MicroPython动手做(30)——物联网之Blynk
#远程网络八音盒电子琴 

 

#MicroPython动手做(30)——物联网之Blynk
#远程网络八音盒电子琴 

from mpython import *
import network
import blynklib
import time
import music

my_wifi = wifi()

my_wifi.connectWiFi("zh", "zy1567")

blynk = blynklib.Blynk("8d52fd7ed2844892a843158e127ed3f2", server="blynk.mpython.cn", port=8080)

@blynk.handle_event("connect")
def connect_handler():
    print('Blynk connected')

@blynk.handle_event("disconnect")
def connect_handler():
    print('Blynk disconnected')

@blynk.handle_event('write V1')
def write_virtual_pin_handler(pin, _value):
    global my_list
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    music.play('C3:2')

@blynk.handle_event('write V2')
def write_virtual_pin_handler(pin, _value):
    global my_list
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    music.play('D3:2')

@blynk.handle_event('write V3')
def write_virtual_pin_handler(pin, _value):
    global my_list
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    music.play('E3:2')

@blynk.handle_event('write V4')
def write_virtual_pin_handler(pin, _value):
    global my_list
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    music.play('F3:2')

@blynk.handle_event('write V5')
def write_virtual_pin_handler(pin, _value):
    global my_list
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    music.play('G3:2')

@blynk.handle_event('write V6')
def write_virtual_pin_handler(pin, _value):
    global my_list
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    music.play('A3:2')

@blynk.handle_event('write V7')
def write_virtual_pin_handler(pin, _value):
    global my_list
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    music.play('B3:2')


oled.fill(0)
oled.DispChar("    远程八音盒电子琴", 0, 16, 1)
oled.show()
rgb[1] = (int(0), int(51), int(0))
rgb.write()
time.sleep_ms(1)
while True:
    blynk.run()

 

点赞  2020-6-9 17:22

mPython X 实验图形编程

 

19.png

点赞  2020-6-9 17:24

#MicroPython动手做(30)——物联网之Blynk
#远程网络八音盒电子琴 (实验视频)

 

https://v.youku.com/v_show/id_XNDcwNTQxMzUxMg==.html

 


 

点赞  2020-6-9 17:33

目录清单
MicroPython动手做(01)——春节后入手了一块K210芯片AI开发板 
https://bbs.eeworld.com.cn/thread-1115786-1-1.html

MicroPython动手做(02)——尝试搭建K210开发板的IDE环境
https://bbs.eeworld.com.cn/thread-1115831-1-1.html

MicroPython动手做(03)——零基础学MaixPy之开机运行
https://bbs.eeworld.com.cn/thread-1116184-1-1.html

MicroPython动手做(04)——零基础学MaixPy之基本示例
https://bbs.eeworld.com.cn/thread-1116438-1-1.html

MicroPython动手做(05)——零基础学MaixPy之LCD液晶屏
https://bbs.eeworld.com.cn/thread-1116577-1-1.html

MicroPython动手做(06)——零基础学MaixPy之单目摄像头
https://bbs.eeworld.com.cn/thread-1116591-1-1.html

MicroPython动手做(07)——零基础学MaixPy之机器视觉
https://bbs.eeworld.com.cn/thread-1116617-1-1.html

MicroPython动手做(08)——零基础学MaixPy之识别颜色 
https://bbs.eeworld.com.cn/thread-1116662-1-1.html

MicroPython动手做(09)——零基础学MaixPy之人脸识别
https://bbs.eeworld.com.cn/thread-1116720-1-1.html

MicroPython动手做(10)——零基础学MaixPy之神经网络KPU
https://bbs.eeworld.com.cn/thread-1116925-1-1.html

MicroPython动手做(11)——搭建掌控板IDE环境
https://bbs.eeworld.com.cn/thread-1117964-1-1.html

MicroPython动手做(12)——掌控板之Hello World
https://bbs.eeworld.com.cn/thread-1118180-1-1.html

MicroPython动手做(13)——掌控板之RGB三色灯 
https://bbs.eeworld.com.cn/thread-1118275-1-1.html

MicroPython动手做(14)——掌控板之OLED屏幕
https://bbs.eeworld.com.cn/thread-1118389-1-1.html

MicroPython动手做(15)——掌控板之AB按键
https://bbs.eeworld.com.cn/thread-1118496-1-1.html

MicroPython动手做(16)——掌控板之图片图像显示
https://bbs.eeworld.com.cn/thread-1118945-1-1.html

MicroPython动手做(17)——掌控板之触摸引脚
https://bbs.eeworld.com.cn/thread-1119462-1-1.html

MicroPython动手做(18)——掌控板之声光传感器
https://bbs.eeworld.com.cn/thread-1119583-1-1.html

MicroPython动手做(19)——掌控板之蜂鸣器与音乐
https://bbs.eeworld.com.cn/thread-1119668-1-1.html

MicroPython动手做(20)——掌控板之三轴加速度
https://bbs.eeworld.com.cn/thread-1119998-1-1.html

MicroPython动手做(21)——掌控板之磁场传感器
https://bbs.eeworld.com.cn/thread-1120188-1-1.html

MicroPython动手做(22)——掌控板之无线广播
https://bbs.eeworld.com.cn/thread-1120835-1-1.html

MicroPython动手做(23)——掌控板之WiFi与蓝牙
https://bbs.eeworld.com.cn/thread-1120934-1-1.html

MicroPython动手做(24)——掌控板之拓展掌控宝 
https://bbs.eeworld.com.cn/thread-1121208-1-1.html

MicroPython动手做(25)——语音合成与语音识别
https://bbs.eeworld.com.cn/thread-1123752-1-1.html

MicroPython动手做(26)——物联网之OneNET
https://bbs.eeworld.com.cn/thread-1125172-1-1.html

MicroPython动手做(27)——物联网之微信小程序
https://bbs.eeworld.com.cn/thread-1125520-1-1.html

MicroPython动手做(28)——物联网之Yeelight
https://bbs.eeworld.com.cn/thread-1125939-1-1.html

MicroPython动手做(29)——物联网之SIoT
https://bbs.eeworld.com.cn/thread-1126090-1-1.html

 MicroPython动手做(30)——物联网之Blynk

https://bbs.eeworld.com.cn/thread-1126427-1-1.html

MicroPython动手做(31)——物联网之Easy IoT 

https://bbs.eeworld.com.cn/thread-1126903-1-1.html

点赞  2020-6-10 14:41

6、Blynk远程控制小车前后左右行驶

 

#MicroPython动手做(30)——物联网之Blynk
#Blynk远程控制小车前后左右行驶

from mpython import *
import network
import blynklib
import music
import time
import parrot

my_wifi = wifi()

my_wifi.connectWiFi("zh", "zy1567")

blynk = blynklib.Blynk("67988e85a728460fb1d543b9d15e0b5f", server="blynk.mpython.cn", port=8080)

@blynk.handle_event("connect")
def connect_handler():
    print('Blynk connected')

@blynk.handle_event("disconnect")
def connect_handler():
    print('Blynk disconnected')

@blynk.handle_event('write V1')
def write_virtual_pin_handler(pin, _value):
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    parrot.set_speed(parrot.MOTOR_1, 80)
    parrot.set_speed(parrot.MOTOR_2, 80)

@blynk.handle_event('write V2')
def write_virtual_pin_handler(pin, _value):
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    parrot.set_speed(parrot.MOTOR_1, -50)
    parrot.set_speed(parrot.MOTOR_2, -50)

@blynk.handle_event('write V3')
def write_virtual_pin_handler(pin, _value):
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    parrot.set_speed(parrot.MOTOR_1, -50)
    parrot.set_speed(parrot.MOTOR_2, 50)

@blynk.handle_event('write V4')
def write_virtual_pin_handler(pin, _value):
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    parrot.set_speed(parrot.MOTOR_1, 50)
    parrot.set_speed(parrot.MOTOR_2, -50)

@blynk.handle_event('write V5')
def write_virtual_pin_handler(pin, _value):
    for i in range(0, len(_value)):
        try: _value[i] = eval(_value[i])
        except: pass
    if len(_value) == 1: _value = _value[0]
    parrot.set_speed(parrot.MOTOR_1, 0)
    parrot.set_speed(parrot.MOTOR_2, 0)


oled.fill(0)
oled.DispChar("         远程控制小车", 0, 1, 1)
oled.show()
music.play('D5:1')
rgb[1] = (int(0), int(51), int(0))
rgb.write()
time.sleep_ms(1)
while True:
    blynk.run()

 

 

点赞  2020-6-22 15:48

设置的APP控制面板的元素为

 

20.jpg

点赞  2020-6-22 15:51

mPython X 实验图形编程

 

21.jpg

点赞  2020-6-22 15:53

#MicroPython动手做(30)——物联网之Blynk
#Blynk远程控制小车前后左右行驶(25秒实验视频)

 

https://v.youku.com/v_show/id_XNDcyMjk2MTUwMA==.html?spm=a2h0c.8166622.PhoneSokuUgc_1.dtitle

 


 

点赞  2020-6-22 16:06
12
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复