1 Onenet创建设备
1.1 输入onenet网址,并登录

1.2 创建产品




1.3 添加设备



2 STM32CubeMX配置ESP8266硬件

2.1 配置串口引脚

2.2 配置串口

2.3 配置DMA

2.4 配置中断

2.5 导出配置,关闭工程

3 OneOS配置
3.1 修改串口缓存大小

3.2 ESP8266配置
我没有配置硬件控制引脚

3.3 打开AT测试工具

3.4 配置onenet

3.5 配置mqtt

3.6 socket已自动打开

3.7生成工程

4 OneOS通过任务连接Onenet
使用的是正点原子的测试任务,由于我的ESP8266没有硬件控制引脚,屏蔽164行这句话。

4.1 配置WiFi密码

4.2 配置onenet设备信息
Onenet设备信息在onenet_device_sample.h里面修改
4.2.1 产品ID和KEY


4.2.2 设备ID和KEY
设备还没有激活
填写设备名称,然后点击详情


4.3 编译工程并下载到开发板

4.4 打开串口终端

连接失败啦啦啦啦啦!!!!!!!
4.5 失败原因
Onenet升级了

4.6 键入旧的设备信息
设备信息位置同4.2.1和4.2.2
4.7 重新编译下载
4.8 串口打印信息

4.9 onenet云设备已激活并在线

4.10 onenet查看数据流
与串口打印信息一致


5 总结
在此简单总结一下,OneOS总体来说还是比较容易上手的,Onenet物联网平台也比较人性化,但是最后造成翻车这个原因后面有时间再解决一下,应该是Onenet升级后和我的OneOS构建版本不匹配了,导致激活设备失败。单纯从物联网生态来讲,OneOS确实比FreeRTOS这种原生态的RTOS要有优势了,前几天还在FreeRTOS上面纠结是移植PAHO MQTT还是自己简单实现必要的功能,在OneOS上面只需要正确配置,完全不用理睬移植的事情,只需要编写好应用任务就好。希望OneOS持续更新,不忘初心,砥砺前行!!!
https://www.bilibili.com/video/BV1hk4y157rE/