当前位置:网站首页>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 |
边栏推荐
- 下载oss文件并修改文件名
- Day_05 传智健康项目-预约管理-预约设置
- Haas506 2.0 development tutorial - Advanced Component Library -modem Net (only supports versions above 2.2)
- C语言 获取秒、毫秒、微妙、纳秒时间戳
- 11、 Realization of textile fabric off shelf function
- Skilled use of slicing operations
- Day_02 传智健康项目-预约管理-检查项管理
- 解析创客教育中的个性化学习进度
- Word pattern for leetcode topic analysis
- mysql如何将日期转为数字
猜你喜欢

In the half year summary, it people just want to lie flat

Vs+qt project transferred to QT Creator

C# wpf 通过绑定实现控件动态加载

Basic RF theory (DB)

RF content learning

Day_ 02 smart communication health project - appointment management - inspection item management

直播带货这么火,如何在小程序中实现视频通话及直播互动功能?

设计师需要懂的数据指标与数据分析模型

Laravel log channel grouping configuration

把CSMA/CD、Token Bus、Token Ring说清楚
随机推荐
Day_08 传智健康项目-移动端开发-体检预约
Day_ 03 smart communication health project - appointment management - inspection team management
ffplay实现自定义输入流播放
C Advanced Learning -- Reflection
There are so many code comments! I laughed
Vs+qt project transferred to QT Creator
综合培养学生脑力思维的少儿编程
Summary of business logic security ideas
[vivado] xilinxcedstore introduction
Leetcode topic resolution valid anagram
C语言 获取秒、毫秒、微妙、纳秒时间戳
常见设置模式(抽象工厂&责任链模式&观察者模式)
haas506 2.0开发教程-高级组件库-modem.sms(仅支持2.2以上版本)
C语言去除字符串尾部的换行(或其他字符)
熟练利用切片操作
C# wpf 通过绑定实现控件动态加载
Day_ 13 smart health project - Chapter 13
Illustration Google V8 18: asynchronous programming (I): how does V8 implement micro tasks?
haas506 2.0开发教程-hota(仅支持2.2以上版本)
C language removes line breaks (or other characters) at the end of strings