当前位置:网站首页>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 
边栏推荐
- 51单片机外设篇:电机
- Unity ugui interaction (new ideas)
- LeetCode·83双周赛·6129.全0子数组的数目·数学
- Yolov5 environment configuration
- [buuctf-n1book][Chapter 2 advanced web]ssrf training
- Redis/Mysql知识概述
- 附加:中半部分sql语句 区/县(数据表)
- [hero planet July training leetcode problem solving daily] 19th binary tree
- How does Flink SQL persist?
- 51 single chip microcomputer key control LED light status
猜你喜欢

这家十年内容产业基建公司,竟是隐形的Web3先行者

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

2022-7-14 JMeter pressure test
![[machine learning] Finally, the important steps of machine learning modeling have been clarified](/img/75/07767ed694502f0c910d35e1447499.jpg)
[machine learning] Finally, the important steps of machine learning modeling have been clarified

SQL injection

51 MCU internal peripherals: timer and counter

Wechat reservation of the completed works of the applet graduation project (6) opening defense ppt

NFT guide for musicians

Redis/Mysql知识概述

sql注入
随机推荐
51单片机外设篇:电机
Django4.0 + Web + MySQL5.7 实现简单登录操作
Silicon Valley class lesson 11 - official account news and wechat authorization
Comparison between symmetric encryption and asymmetric encryption
How to avoid duplicate data when the database is high and distributed
Redis/Mysql知识概述
How to choose a low code software development platform?
Arcgis10.2 installation tutorial
Additional: SQL statement area / county in the lower half (data table)
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
JS touch screen game source code ice and snow journey
js触屏小游戏源码冰雪之旅
优炫数据库对数据的加密是如何做的?
JMeter test plan cannot be saved solution
为什么说DAO是未来的公司形式
音乐人的 NFT 指南
Django4.0 + web + MySQL 5.7 realize simple login operation
Silicon Valley classroom lesson 12 - official account on demand course and live broadcast management module
NFT guide for musicians
Visual query (sp_helptext) -- quick query of stored procedures containing specified strings (with source code)