05 Ciso模拟器连接腾讯云物联网开发平台

Ciso声明:本篇文章基于使用腾讯云物联网平台连接自定义esp8266物联网设备(腾讯连连控制开关实现) - CSDN App改编

一、总体概览

功能描述:

使用腾讯连连小程序进行控制,

Alarm(警铃):开的时候,亮红灯;关的时候关闭。

RGB LED(三色灯):有4个属性值,Red,Green,Blue,OFF,分别对应红灯,绿灯,蓝灯,关闭。

Fan(风扇):有3个属性值,OFF,Low,High,分别对应关闭、一档、二档。

MCU(单片机):控制这三个设备

二、 Ciso模拟器部分

MCU(单片机编程):

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| from realudp import * from time import * from gpio import * from options import Options from time import * import math from physical import * from gpio import * from environment import Environment from ioeclient import IoEClient IP = "127.0.0.1" PORT = 1834 switchStatus="0" colorStr="0" colorID =3 bright =1023 fengShanControl="0" #from pyjs import * def onLedRGB(rgb): if rgb==0: #digitalWrite(1,HIGH) #digitalWrite(2,LOW) #digitalWrite(3,LOW) analogWrite(1,bright) analogWrite(2,0) analogWrite(3,0) if rgb==1: #digitalWrite(1,LOW) #digitalWrite(2,HIGH) #digitalWrite(3,LOW) analogWrite(1,0) analogWrite(2,bright) analogWrite(3,0) if rgb==2: #digitalWrite(1,LOW) #digitalWrite(2,LOW) #digitalWrite(3,HIGH) analogWrite(1,0) analogWrite(2,0) analogWrite(3,bright) if rgb==3: digitalWrite(1,LOW) digitalWrite(2,LOW) digitalWrite(3,LOW) def onUDPReceive(ip, port, data): global colorStr global switchStatus global colorID global bright global fengShanControl print("received from " + ip + ":" + str(port) + ":" + data); data2 = data.split('{')2.split('}')0 print("data2: "+data2) for i in range(0,len(data2)): if( data2i == 's' and data2i+1 == 'w'): switchStatus = data2i+8 print("switchStatus = "+switchStatus) if( data2i == 'c' and data2i+1 == 'o'): colorStr = data2i+7 print("colorStr = "+colorStr) if( data2i == 'f' and data2i+1 == 'e'): fengShanControl = data2i+10 print("fengShanControl = "+fengShanControl) if "0" in colorStr: colorID = 0 onLedRGB(colorID) if "1" in colorStr: colorID = 1 onLedRGB(colorID) if "2" in colorStr: colorID = 2 onLedRGB(colorID) if "3" in colorStr: colorID = 3 onLedRGB(colorID) if "0" in switchStatus: digitalWrite(4,LOW) #client.send("Alarm Closed!") if "1" in switchStatus: digitalWrite(4,HIGH) #client.send("Alarm Opened!") if "0" in fengShanControl: customWrite(0,"0") if "1" in fengShanControl: customWrite(0,"1") if "2" in fengShanControl: customWrite(0,"2") def main(): socket = RealUDPSocket() socket.onReceive(onUDPReceive) print(socket.begin(1834)) pinMode(1,OUT) pinMode(2,OUT) pinMode(3,OUT) pinMode(4,OUT) count = 0 while True: # count += 1 # socket.send(IP, PORT, "hello " + str(count)) sleep(1) if name == "main": main() |

三、腾讯云物联网开发平台

参考链接里的博客

四、腾讯连连小程序

扫描腾讯云的二维码即可

五、演示视频

相关推荐
AKAMAI13 小时前
2026年Gartner Peer Insights 边缘分布平台客户之声将Akamai评为客户之选
人工智能·云计算
故乡dee云17 小时前
AWS 产品太多不会选?按“网站、数据库、文件、日志”4 类需求快速匹配
数据库·云计算·aws
yunlaodacom1 天前
腾讯云国际站注册:云防火墙外联告警频发?Linux异常连接与恶意进程溯源全指南
云计算·腾讯云·云防火墙
聚搜云——JuSouClouD1 天前
深圳阿里云代理商:云主机性能下滑 诊断优化实战分享
阿里云·云计算
szephyr2 天前
腾讯云 ADP 智能体的 Skills 版本回滚总是回到旧配置,是缓存没清还是版本管理没开?
java·缓存·腾讯云
燐妤2 天前
腾讯云 Ubuntu 24.04 + Docker 同时部署多个 Python Web 项目:没有域名也能用 IP 访问
ubuntu·docker·腾讯云
骇客野人2 天前
阿里云运维手册(通用生产版|云上运维标准化文档)
运维·阿里云·云计算
Benszen3 天前
云计算基础-13:Linux网络管理实战-1
linux·运维·云计算
szephyr3 天前
腾讯云 ADP 智能体的 Skills 配置变更后没有走灰度,直接全量替换出了问题怎么定位?
java·前端·腾讯云·腾讯云adp
翼龙云_cloud3 天前
亚马逊云代理商:VPC网络ACL和安全组配置实践 从网络层到实例层的双重防护
运维·网络·安全·云计算·aws