当前位置:网站首页>Haas506 2.0 development tutorial - Advanced Component Library -modem SMS (only supports versions above 2.2)
Haas506 2.0 development tutorial - Advanced Component Library -modem SMS (only supports versions above 2.2)
2022-06-23 06:37:00 【Zhiyunfu】
haas506 2.0 Development tutorial - Advanced component library -modem.sms
1. texting
Case description :
- Insert SIM card
- Send a text message
- ‘yourPhoneNumber’ Need to change to corresponding number (str Format )
main.py
# -*- coding: UTF-8 -*-
from modem import sms
import utime as time
if __name__ == '__main__':
# Instantiation
smss = sms()
time.sleep(1)
smss.sendTextMsg('yourPhoneNumber','welcome to use haas506','GSM')
smss.sendTextMsg('yourPhoneNumber',' Welcome to use haas506','UCS2')
design sketch - send out 
2. Receive text messages
- Receive SMS from mobile phone
main.py
# -*- coding: UTF-8 -*-
from modem import sms
import utime as time
def sms_cb(args):
# character string
ind_flag = args[0]
mes_buf = args[1]
mes_num = args[2]
# print("type of mes_buf:",type(mes_buf))
print('new message:ind_flag:{},mes_buf:{},mes_num:{}'.format(ind_flag,mes_buf,mes_num))
if __name__ == '__main__':
# Instantiation
smss = sms()
# Receive SMS callback
print('--------------')
time.sleep(5)
smss.setCallbacks(sms_cb)
design sketch - receive
Be careful : Use your cell phone to haas506 When texting , The Chinese serial port can not display the assistant , There are two solutions at this point :(1) Change a serial port assistant that can set Chinese display .(2) Save the serial port log , open the log file , Chinese characters will be displayed .
3.Class-sms
| setCallbacks | sendTextMsg |
|---|---|
| Receive text messages | Text messaging |
SMS - SMS function
- The function prototype :
modem.sms()
- Parameter description : nothing
setCallbacks - Realize the function of receiving SMS
The functionality : Realize the function of receiving SMS
The function prototype :
sms.setCallbacks(sms_cb)
- Parameter description :
| Parameters | explain |
|---|---|
| sms_cb | SMS callback function , See the example for the specific form and usage of callback |
sendTextMsg - Text messaging
The functionality : Text messaging
The function prototype :
sms.sendTextMsg(phoneNumber, msg, codeMode)
- Parameter description :
| Parameters | explain |
|---|---|
| phoneNumber | SMS number |
| msg | Content of short message |
| codeMode | The character encoding used ,‘GSM’ - GSM Encoding mode ;‘UCS2’ - UCS2 Encoding mode |
| Character encoding | explain |
|---|---|
| ‘GSM’ | GSM Encoding mode , Used to send English SMS |
| ‘UCS2’ | UCS2 Encoding mode , It can be used to send Chinese SMS and English SMS |
边栏推荐
- RF content learning
- Day_07 传智健康项目-Freemarker
- Gridsearchcv (grid search), a model parameter adjuster in sklearn
- 程序员的真实想法 | 每日趣闻
- A review: neural oscillation and brain stimulation in Alzheimer's disease
- Termux
- haas506 2.0开发教程-sntp(仅支持2.2以上版本)
- haas506 2.0开发教程-高级组件库-modem.voiceCall(仅支持2.2以上版本)
- Coordinate transformation
- Day_ 13 smart health project - Chapter 13
猜你喜欢

Day_ 01 smart communication health project - project overview and environmental construction

Day_ 07 smart communication health project FreeMarker

Gridsearchcv (grid search), a model parameter adjuster in sklearn

Softing dataFEED OPC Suite将西门子PLC数据存储到Oracle数据库中

Synchronous switching power supply reduces EMI layout dv/dt di/dt

Day_04 传智健康项目-预约管理-套餐管理
![[vivado] xilinxcedstore introduction](/img/c7/4f203d125ddb18378398a7eaeffaf5.png)
[vivado] xilinxcedstore introduction

如何实现与FDA保持邮件通信安全加密?

Measurement principle and thickness measurement mode of spectral confocal

Laravel log channel 分组配置
随机推荐
json转化为proto
C language obtains second, millisecond, subtle and nanosecond timestamps
Link of Baidu URL parameter? Research on URL parameter encryption and decryption (code example)
qt creater搭建osgearth环境(osgQT MSVC2017)
Haas 506 2.0 Tutoriel de développement - bibliothèque de composants avancés - modem. SMS (ne prend en charge que les versions supérieures à 2,2)
Day_05 传智健康项目-预约管理-预约设置
English语法_副词 - ever / once
sklearn sklearn中classification_report&精确度/召回率/F1值
设计师需要懂的数据指标与数据分析模型
QT creator builds osgearth environment (osgqt msvc2017)
开源生态|超实用开源License基础知识扫盲帖(下)
Day_07 传智健康项目-Freemarker
Leetcode topic resolution valid Sudoku
如何查看本机IP
Fastdata pole | insight report on e-commerce consumption of young Chinese users 2021
图解 Google V8 # 17:消息队列:V8是怎么实现回调函数的?
Haas506 2.0 development tutorial - Advanced Component Library -modem Net (only supports versions above 2.2)
[vivado] xilinxcedstore introduction
Gridsearchcv (grid search), a model parameter adjuster in sklearn
There are so many code comments! I laughed