当前位置:网站首页>Wechat applet obtains the data of ---- onenet and controls the on-board LED of STM32
Wechat applet obtains the data of ---- onenet and controls the on-board LED of STM32
2022-07-25 09:16:00 【Kicked player】
I wrote it before Android studio control stm32 The article , This time I learned the network programming of wechat applet , By the way, I also write a routine of network programming , Some parts of the article are borrowed from this front-end boss , You can pay attention to it —> Portal
explain : I will only demonstrate a simple wechat applet obtain / control stm32 The operation of , See the blogger above for other beautified interfaces
How to stm32 Data transferred to onenet I've written before , You can read what you don't understand —>stm32–onenet
The operation instructions are not repeated here , Only demonstrate the operation of wechat applet
Prepare the software ;
1. Android wechat developer tool , Here's the picture , Download link —> WeChat official account

step :
1. Add onent Domain name of , Otherwise, network programming cannot be realized , Here's the picture

Get Method
2. Write code in wechat developer tools
2.1 First, in the app.json Create a new folder in it

2.2 open home.wxml Write controls in it for similar operations

Code instructions : there getInfo, It's similar to the click event in Android onclick Click on the event function , It means , Click the button , Will jump to getInfo function , Then do the following

there url If you don't understand , You can see my previous ApiPost The article , There are detailed instructions , How to find and use URL–>ApiPost Usage method
method: The default is GET Method , You can omit , If it is Post Just write Post That's it
As for why wendu:res.data.data.datastreams[0].datapoints[0].value, Write this to get data ?,
res.data It represents the received data
adopt json Data format , We can get the value of specific data flow layer by layer 
Post Method
alike , and Get The method is the same 
Because of the stm32 Is to receive knob:0, bring led State flip , Those who don't understand here can go to see me before stm32 The article , The instructions there are very detailed , Very clear !
As soon as you start the applet, you automatically get the data

The final effect :
1. Click on post request ,stm32 Upper led State flip
2. Temperature and humidity are displayed on the wechat applet page … And other sensors 
边栏推荐
- Learn about spark project on Nebula graph
- What is steel grating?
- activemq--可持久化机制之AMQ
- Learning Weekly - total issue 63 - an open source local code snippet management tool
- Redis-哨兵,主从部署详细篇
- 51 MCU internal peripherals: serial port communication
- How to realize the drop-down option box of wechat applet
- Read and write models and organize notes
- uniapp中scroll-view的坑
- NFT guide for musicians
猜你喜欢

The international summit osdi included Taobao system papers for the first time, and end cloud collaborative intelligence was recommended by the keynote speech of the conference

Labview--- signal generator

Disable module (attribute node) in LabVIEW

Visual query (sp_helptext) -- quick query of stored procedures containing specified strings (with source code)

酷炫canvas动画冲击波js特效

What version of Oracle10g single instance database is better to upgrade to? Ask for suggestions

Yolov5 environment configuration

机器人跳跃问题

Unity ugui interaction (new ideas)

C语言实现二叉平衡树
随机推荐
28.插槽
Feiling ok1028a core board adapts to rtl8192cu WiFi module
Yolov5 environment configuration
Learning Weekly - total issue 63 - an open source local code snippet management tool
table表格展开内部行切换效果
Learn about spark project on Nebula graph
Canvas text JS special effect composed of many circles
js小游戏源码魔塔闯关下载
[stl]list Simulation Implementation
Oracle10g单实例数据库升级到哪个版本好,求建议
mysql中的数据结果排名
[deep learning] mask Dino Trilogy - the correct way to open Detr Pandora's box
(self drawn ugly picture) simple understanding tcp/ip three handshakes and four waves
[graduation project] cinema booking management system based on micro Service Framework
How does Youxuan database encrypt data?
51 MCU internal peripherals: serial port communication
Programmers can't SQL? Ashes Engineer: all waiting to be eliminated! This is a must skill!
CIR industrial automation radar
Additional: SQL statement area / county in the middle half (data table)
学习周刊-总第 63 期-一款开源的本地代码片段管理工具