基础案例2.0-定位电话
- 简介
- 准备
- 硬件图
- 功能实现
- 1、物联网平台开发
- 2、设备端开发
- 调试
- 物联网应用开发
- 3.1新建‘普通项目’
- 3.2关联产品和设备
- 3.3 新建web应用
- 3.4添加组件
- 3.5 保存 预览
简介
本案例模拟手机通话功能,主控板上有三个按钮,RST重启按钮、BOOT下载模式按钮、KEY1自定义按钮。KEY1按钮可以自定义功能。本案例使用KEY1键来实现拨打电话与挂断电话。并在通话时向云端发送当前位置信息,并在网页地图上显示出设备最近上传的位置信息.
准备
本案例需要的硬件
器材 | 数量 |
HaaS506开发板 | 1 |
中科微-ATGM336H-5N系列模块 | 1 |
OLED显示屏 | 1 |
SIM卡 | 1 |
杜邦线 | 若干 |
硬件图
功能实现
1、物联网平台开发
第一次使用物联网平台的读者,需要开通实例后使用物联网平台功能。也可以使用免费的公共实例进行开发,在阿里云物联网平台中,左上角选择‘华东2-上海’,点击‘公共实例’,即可开通。
1、平台产品创建
① 登录物联网平台控制台
② 在实例概览页面,找到对应的实例,单击实例进入实例详情页面。
注意 在中国地域,目前仅华东2(上海)地域开通了公共实例服务。
在左侧导航栏,选择设备管理 > 产品,单击创建产品。
输入产品信息
③ 添加设备
注意:设备名称需要输入IMEI号,代码需要使用设备名称IMEI进行动态注册
点击确定
④ 打开动态注册,要连接云平台必须打开。在这个界面也可以查看需要复制的产品信息。
2、创建产品属性(添加物模型)物模型可以导入或手动添加,以下为手动添加的操作流程。
- 选择产品功能定义–编辑草稿
- 添加自定义功能
使用默认 - - 地理位置 物模型
发布上线
3、产品发布,动态注册一定要打开。
2、设备端开发
- 第一次使用开发板的读者可以按照HaaS506 快速开始搭建开发环境。
- 搭建完后复制代码到Visual Studio Code,复制产品证书到代码相应位置。
aliyun.py
# coding=utf-8
import network
import ujson
import utime as time
import modem
from aliyunIoT import Device
import kv
global deviceName,g_connect_status,device_dyn_resigter_succed,netw
g_connect_status = False
netw = None
device = None
deviceSecret = None
#更改产品信息
###############################
productKey = "your productKey "
productSecret = "your productSecret "
###############################
device_dyn_resigter_succed = False
#初始化物联网平台Device类,获取device实例
device = Device()
# 定义升级包的下载和安装路径,其中url,hash_type和hash 会通过服务端推送被保存下来
info = {
'url': '',
'store_path': '/data/pyamp/app.zip',
'install_path': '/data/pyamp/',
'length': 0,
'hash_type': '',
'hash': ''
}
#当iot设备连接到物联网平台的时候触发'connect' 事件
def on_connect(data):
global module_name,default_ver,productKey,deviceName,deviceSecret,on_trigger,on_download,on_verify,on_upgrade
print('***** connect lp succeed****')
data_handle = {}
data_handle['device_handle'] = device.getDeviceHandle()
#当iot云端下发属性设置时,触发'props'事件
def on_props(request):
print('clound req data is {}'.format(request))
#当连接断开时,触发'disconnect'事件
def on_disconnect():
print('linkkit is disconnected')
#当iot云端调用设备service时,触发'service'事件
def on_service(id,request):
print('clound req id is {} , req is {}'.format(id,request))
#当设备跟iot平台通信过程中遇到错误时,触发'error'事件
def on_error(err):
print('err msg is {} '.format(err))
#网络连接的回调函数
def on_4g_cb(args):
global g_connect_status
pdp = args[0]
netwk_sta = args[1]
if netwk_sta == 1:
g_connect_status = True
else:
g_connect_status = False
#网络连接
def connect_network():
global netw,on_4g_cb,g_connect_status
#NetWorkClient该类是一个单例类,实现网络管理相关的功能,包括初始化,联网,状态信息等.
netw = network.NetWorkClient()
g_register_network = False
if netw._stagecode is not None and netw._stagecode == 3 and netw._subcode == 1:
g_register_network = True
else:
g_register_network = False
if g_register_network:
#注册网络连接的回调函数on(self,id,func); 1代表连接,func 回调函数 ;return 0 成功
netw.on(1,on_4g_cb)
netw.connect(None)
else:
print('网络注册失败')
while True:
if g_connect_status:
print('网络连接成功')
break
time.sleep_ms(20)
#动态注册回调函数
def on_dynreg_cb(data):
global deviceSecret,device_dyn_resigter_succed
deviceSecret = data
device_dyn_resigter_succed = True
# 连接物联网平台
def dyn_register_device(productKey,productSecret,deviceName):
global on_dynreg_cb,device,deviceSecret,device_dyn_resigter_succed
key = '_amp_customer_devicesecret'
deviceSecretdict = kv.get(key)
print("deviceSecretdict:",deviceSecretdict)
if isinstance(deviceSecretdict,str):
deviceSecret = deviceSecretdict
if deviceSecretdict is None or deviceSecret is None:
key_info = {
'productKey': productKey ,
'productSecret': productSecret ,
'deviceName': deviceName
}
# 动态注册一个设备,获取设备的deviceSecret
#下面的if防止多次注册,当前若是注册过一次了,重启设备再次注册就会卡住,
if not device_dyn_resigter_succed:
device.register(key_info,on_dynreg_cb)
def connect():
global deviceName,g_connect_status,device_dyn_resigter_succed
deviceName = None
# 获取设备的IMEI 作为deviceName 进行动态注册
deviceName = modem.info.getDevImei()
# 连接网络
connect_network()
if deviceName is not None and len(deviceName) > 0 :
#动态注册一个设备
dyn_register_device(productKey,productSecret,deviceName)
else:
print("获取设备IMEI失败,无法进行动态注册")
while deviceSecret is None:
time.sleep(0.2)
print('动态注册成功:' + deviceSecret)
key_info = {
'region' : 'cn-shanghai' ,
'productKey': productKey ,
'deviceName': deviceName ,
'deviceSecret': deviceSecret ,
'keepaliveSec': 60,
}
#打印设备信息
print(key_info)
#device.ON_CONNECT 是事件,on_connect是事件处理函数/回调函数
device.on(device.ON_CONNECT,on_connect)
device.on(device.ON_DISCONNECT,on_disconnect)
device.on(device.ON_PROPS,on_props)
device.on(device.ON_SERVICE,on_service)
device.on(device.ON_ERROR,on_error)
device.connect(key_info)
def up_data(key,value):
d_str = ujson.dumps({key:value})
data={
'params':d_str
}
device.postProps(data)
main.py
# coding=utf-8
from modem import voiceCall
from audio import Audio
import utime as time
from driver import GPIO
from driver import UART
import aliyun
import _thread
from ssd1306 import SSD1306_128_64
global flag
flag=0
#实例化key1
key1=GPIO(10,10)
key1.open("KEY1")
#gbs初始化
gps_module=UART()
gps_module.open("serial1")
gps_module.setBaudRate(9600) #gps模块的波特率是9600
readBuf=bytearray(512) #创建一个字节数组,用于接受串口数据
#oled初始化
disp=SSD1306_128_64()
disp.begin() # 初始化
disp.clear() # 清屏
#按键中断回调函数
def key1_callback(args):
global flag
if flag==0:
flag=1
# 拨打电话
print('=== call ===')
#将yourphone改为用户电话号码,文本格式,加''
vc.callStart('电话号码')
time.sleep(1)
elif flag==1:
flag=0
#挂断电话
print('----callend----')
vc.callEnd()
else:
pass
key1.disableIrq()
key1.clearIrq()
def enable_key():
#开启中断
key1.enableIrq(key1_callback)
#接听回调
def voice_callback(args):
global flag
if args[0] == 10:
print('voicecall incoming call, PhoneNO.: ', args[6])
flag = 1
elif args[0] == 11:
print('voicecall connected, PhoneNO.: ', args[6])
flag = 1
elif args[0] == 12:
print('voicecall disconnect')
flag = 0
elif args[0] == 13:
print('voicecall is waiting, PhoneNO.: ', args[6])
elif args[0] == 14:
print('voicecall dialing, PhoneNO.: ', args[6])
elif args[0] == 15:
print('voicecall alerting, PhoneNO.: ', args[6])
elif args[0] == 16:
print('voicecall holding, PhoneNO.: ', args[6])
#纬度
def latitude(d,h):
if d=="":
return 0
hemi="" if h=="N" else "-"
#度
deg=int(d[0:2])
#分
min=str(float(d[2:])/60)[1:]
return hemi +str(deg)+min
#经度
def longitude(d,h):
if d=="":
return 0
hemi="" if h=="E" else "-"
#度
deg=int(d[0:3])
#分
min=str(float(d[3:])/60)[1:]
return hemi +str(deg)+min
location_data = {}
def gps():
while True:
#串口读
size=gps_module.read(readBuf)
data=readBuf
# print(readBuf)
#将字节数据转化成字符串数据
data_str=data.decode()
# 判断是否有数据 且数据中是否包含"$GNRMC"
if size!=0 and "$GNRMC" in data_str and "$GNVTG" in data_str:
#删除"\r\n"后,字符串变为列表
data_list=data_str.split('\r\n')
# print(data_list)
for i in range(len(data_list)):
if "$GNRMC" in data_list[i]:
# print(data_list[i])
#删除","
result=data_list[i].split(',')
print(result)
#$GNRMC,075622.000,A,3116.56922,N,12044.12475,E,0.00,0.00,020422,,,A,V*01
#['$GNRMC', '075622.000', 'A', '3116.56922', 'N', '12044.12475', 'E', '0.00', '0.00', '020422', '', '', 'A', 'V*01']
# 在GNRMC中取数据
if len(result)==14:
lat=latitude(result[3],result[4])
long=longitude(result[5],result[6])
print("lat:",lat)
print("long:",long)
disp.oled_showstr(0,4,'lat',2)
disp.oled_showstr(0,6,'long',2)
try:
disp.oled_showstr(60,4,str(round(float(lat),2)),2)
disp.oled_showstr(60,6,str(round(float(long),2)),2)
except:
print('GPS尚未开启')
if flag ==1:
disp.oled_showstr(0,1,' ',1)
disp.oled_showstr(0,1,'calling',1)
aliyun.up_data("GeoLocation",{"longitude":float(long),"latitude":float(lat),"altitude":30.1,"CoordinateSystem":1})
else:
disp.oled_showstr(0,1,' ',1)
disp.oled_showstr(0,1,'no call',1)
time.sleep(1)
if __name__ == '__main__':
aliyun.connect() #连接阿里云
#拨打电话实例化
vc = voiceCall()
ad = Audio()
ad.set_pa() #电话功能需要预先开启功放
ad.setVolume(10) #设置音量
time.sleep(1)
# 设置自动应答
vc.setCallback(voice_callback) # 设置监听回调函数
vc.setAutoAnswer(5000) # 设置自动应答时间 ms
print('-----start-----')
_thread.start_new_thread(gps, ()) #开启gps线程
#打开按键使能
enable_key()
codetab.py
##*-- 文字: 煜 --*#
##*-- 文字: 瑛 --*#
##*-- 文字: 物 --*#
##*-- 文字: 联 --*#
##*-- 文字: 网 --*#
##*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*#
#列表大小:10*16
F1=[
0x80,0x70,0x00,0xFF,0x10,0x08,0x00,0x7E,0x2A,0xAA,0x2A,0x2A,0x2A,0x7E,0x00,0x00,
0x80,0x60,0x18,0x07,0x08,0x50,0x42,0x4A,0x52,0x42,0x43,0x42,0x52,0x4A,0x42,0x00, #煜
0x84,0x84,0xFC,0x84,0x84,0x00,0x04,0xC4,0x5F,0x44,0xF4,0x44,0x5F,0xC4,0x04,0x00,
0x10,0x30,0x1F,0x08,0x08,0x00,0x84,0x47,0x24,0x14,0x0F,0x14,0x24,0x47,0x84,0x00, #瑛
0x40,0x3C,0x10,0xFF,0x10,0x10,0x20,0x10,0x8F,0x78,0x08,0xF8,0x08,0xF8,0x00,0x00,
0x02,0x06,0x02,0xFF,0x01,0x01,0x04,0x42,0x21,0x18,0x46,0x81,0x40,0x3F,0x00,0x00, #物
0x02,0xFE,0x92,0x92,0xFE,0x02,0x00,0x10,0x11,0x16,0xF0,0x14,0x13,0x10,0x00,0x00,
0x10,0x1F,0x08,0x08,0xFF,0x04,0x81,0x41,0x31,0x0D,0x03,0x0D,0x31,0x41,0x81,0x00, #联
0x00,0xFE,0x02,0x22,0x42,0x82,0x72,0x02,0x22,0x42,0x82,0x72,0x02,0xFE,0x00,0x00,
0x00,0xFF,0x10,0x08,0x06,0x01,0x0E,0x10,0x08,0x06,0x01,0x4E,0x80,0x7F,0x00,0x00, #网
]
# 每个字符是8x16(宽x高) 点阵,
F2=[
0x10,0xF0,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20, #*"h",0*#
0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x19,0x24,0x24,0x12,0x3F,0x20,0x00, #*"a",1*#
0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x19,0x24,0x24,0x12,0x3F,0x20,0x00, #*"a",2*#
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00, #*"s",3*#
0x00,0xF8,0x88,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x20,0x20,0x20,0x11,0x0E,0x00, #*"5",4*#
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00, #*"0",5*#
0x00,0xE0,0x10,0x88,0x88,0x90,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x20,0x1F,0x00, #*"6",6*#
]
#字符串 6x8点阵
F6x8=[
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00],# sp
[0x00, 0x00, 0x00, 0x2f, 0x00, 0x00],# !
[0x00, 0x00, 0x07, 0x00, 0x07, 0x00],# "
[0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14],# #
[0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12],# $
[0x00, 0x62, 0x64, 0x08, 0x13, 0x23],# %
[0x00, 0x36, 0x49, 0x55, 0x22, 0x50],# &
[0x00, 0x00, 0x05, 0x03, 0x00, 0x00],# '
[0x00, 0x00, 0x1c, 0x22, 0x41, 0x00],# (
[0x00, 0x00, 0x41, 0x22, 0x1c, 0x00],# )
[0x00, 0x14, 0x08, 0x3E, 0x08, 0x14],# *
[0x00, 0x08, 0x08, 0x3E, 0x08, 0x08],# +
[0x00, 0x00, 0x00, 0xA0, 0x60, 0x00],# ,
[0x00, 0x08, 0x08, 0x08, 0x08, 0x08],# -
[0x00, 0x00, 0x60, 0x60, 0x00, 0x00],# .
[0x00, 0x20, 0x10, 0x08, 0x04, 0x02],# #
[0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E],# 0
[0x00, 0x00, 0x42, 0x7F, 0x40, 0x00],# 1
[0x00, 0x42, 0x61, 0x51, 0x49, 0x46],# 2
[0x00, 0x21, 0x41, 0x45, 0x4B, 0x31],# 3
[0x00, 0x18, 0x14, 0x12, 0x7F, 0x10],# 4
[0x00, 0x27, 0x45, 0x45, 0x45, 0x39],# 5
[0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30],# 6
[0x00, 0x01, 0x71, 0x09, 0x05, 0x03],# 7
[0x00, 0x36, 0x49, 0x49, 0x49, 0x36],# 8
[0x00, 0x06, 0x49, 0x49, 0x29, 0x1E],# 9
[0x00, 0x00, 0x36, 0x36, 0x00, 0x00],# :
[0x00, 0x00, 0x56, 0x36, 0x00, 0x00],# ;
[0x00, 0x08, 0x14, 0x22, 0x41, 0x00],# <
[0x00, 0x14, 0x14, 0x14, 0x14, 0x14],# =
[0x00, 0x00, 0x41, 0x22, 0x14, 0x08],# >
[0x00, 0x02, 0x01, 0x51, 0x09, 0x06],# ?
[0x00, 0x32, 0x49, 0x59, 0x51, 0x3E],# @
[0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C],# A
[0x00, 0x7F, 0x49, 0x49, 0x49, 0x36],# B
[0x00, 0x3E, 0x41, 0x41, 0x41, 0x22],# C
[0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C],# D
[0x00, 0x7F, 0x49, 0x49, 0x49, 0x41],# E
[0x00, 0x7F, 0x09, 0x09, 0x09, 0x01],# F
[0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A],# G
[0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F],# H
[0x00, 0x00, 0x41, 0x7F, 0x41, 0x00],# I
[0x00, 0x20, 0x40, 0x41, 0x3F, 0x01],# J
[0x00, 0x7F, 0x08, 0x14, 0x22, 0x41],# K
[0x00, 0x7F, 0x40, 0x40, 0x40, 0x40],# L
[0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F],# M
[0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F],# N
[0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E],# O
[0x00, 0x7F, 0x09, 0x09, 0x09, 0x06],# P
[0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E],# Q
[0x00, 0x7F, 0x09, 0x19, 0x29, 0x46],# R
[0x00, 0x46, 0x49, 0x49, 0x49, 0x31],# S
[0x00, 0x01, 0x01, 0x7F, 0x01, 0x01],# T
[0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F],# U
[0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F],# V
[0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F],# W
[0x00, 0x63, 0x14, 0x08, 0x14, 0x63],# X
[0x00, 0x07, 0x08, 0x70, 0x08, 0x07],# Y
[0x00, 0x61, 0x51, 0x49, 0x45, 0x43],# Z
[0x00, 0x00, 0x7F, 0x41, 0x41, 0x00],# [
[0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55],# 55
[0x00, 0x00, 0x41, 0x41, 0x7F, 0x00],# ]
[0x00, 0x04, 0x02, 0x01, 0x02, 0x04],# ^
[0x00, 0x40, 0x40, 0x40, 0x40, 0x40],# _
[0x00, 0x00, 0x01, 0x02, 0x04, 0x00],# '
[0x00, 0x20, 0x54, 0x54, 0x54, 0x78],# a
[0x00, 0x7F, 0x48, 0x44, 0x44, 0x38],# b
[0x00, 0x38, 0x44, 0x44, 0x44, 0x20],# c
[0x00, 0x38, 0x44, 0x44, 0x48, 0x7F],# d
[0x00, 0x38, 0x54, 0x54, 0x54, 0x18],# e
[0x00, 0x08, 0x7E, 0x09, 0x01, 0x02],# f
[0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C],# g
[0x00, 0x7F, 0x08, 0x04, 0x04, 0x78],# h
[0x00, 0x00, 0x44, 0x7D, 0x40, 0x00],# i
[0x00, 0x40, 0x80, 0x84, 0x7D, 0x00],# j
[0x00, 0x7F, 0x10, 0x28, 0x44, 0x00],# k
[0x00, 0x00, 0x41, 0x7F, 0x40, 0x00],# l
[0x00, 0x7C, 0x04, 0x18, 0x04, 0x78],# m
[0x00, 0x7C, 0x08, 0x04, 0x04, 0x78],# n
[0x00, 0x38, 0x44, 0x44, 0x44, 0x38],# o
[0x00, 0xFC, 0x24, 0x24, 0x24, 0x18],# p
[0x00, 0x18, 0x24, 0x24, 0x18, 0xFC],# q
[0x00, 0x7C, 0x08, 0x04, 0x04, 0x08],# r
[0x00, 0x48, 0x54, 0x54, 0x54, 0x20],# s
[0x00, 0x04, 0x3F, 0x44, 0x40, 0x20],# t
[0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C],# u
[0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C],# v
[0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C],# w
[0x00, 0x44, 0x28, 0x10, 0x28, 0x44],# x
[0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C],# y
[0x00, 0x44, 0x64, 0x54, 0x4C, 0x44],# z
[0x14, 0x14, 0x14, 0x14, 0x14, 0x14]# horiz lines
]
#字符串 8x16点阵
F8X16=[
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,# 0
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,#! 1
0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,#" 2
0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,## 3
0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,#$ 4
0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,#% 5
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,#& 6
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,#' 7
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,#( 8
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,#) 9
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,#* 10
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,#+ 11
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,#, 12
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,#- 13
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,#. 14
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,## 15
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,#0 16
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,#1 17
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,#2 18
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,#3 19
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,#4 20
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,#5 21
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,#6 22
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,#7 23
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,#8 24
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,#9 25
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,#: 26
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,#; 27
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,#< 28
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,#= 29
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,#> 30
0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,#? 31
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,#@ 32
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,#A 33
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,#B 34
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,#C 35
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,#D 36
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,#E 37
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,#F 38
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,#G 39
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,#H 40
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,#I 41
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,#J 42
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,#K 43
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,#L 44
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,#M 45
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,#N 46
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,#O 47
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,#P 48
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,#Q 49
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,#R 50
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,#S 51
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,#T 52
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,#U 53
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,#V 54
0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,#W 55
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,#X 56
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,#Y 57
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,#Z 58
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,#[ 59
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,#\ 60
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,#] 61
0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,#^ 62
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,#_ 63
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,#` 64
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,#a 65
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,#b 66
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,#c 67
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,#d 68
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,#e 69
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,#f 70
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,#g 71
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,#h 72
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,#i 73
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,#j 74
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,#k 75
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,#l 76
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,#m 77
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,#n 78
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,#o 79
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,#p 80
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,#q 81
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,#r 82
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,#s 83
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,#t 84
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,#u 85
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,#v 86
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,#w 87
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,#x 88
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,#y 89
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,#z 90
0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,# 91
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,#| 92
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,# 93
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,#~ 94
]
BMP1=[
0x00,0x03,0x05,0x09,0x11,0xFF,0x11,0x89,0x05,0xC3,0x00,0xE0,0x00,0xF0,0x00,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x28,0xFF,0x11,0xAA,0x44,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x01,0x38,0x44,0x82,0x92,
0x92,0x74,0x01,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x44,0xC7,0x01,0x7D,
0x7D,0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x01,0xFF,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x00,0x00,
0x6D,0x6D,0x6D,0x6D,0x6D,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x40,0x40,
0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDB,0xDB,0xDB,0xDB,0xDB,0x00,0x00,
0xDB,0xDB,0xDB,0xDB,0xDB,0x00,0x00,0xDB,0xDB,0xDB,0xDB,0xDB,0x00,0x00,0xDB,0xDB,
0xDB,0xDB,0xDB,0x00,0x00,0xDA,0xDA,0xDA,0xDA,0xDA,0x00,0x00,0xD8,0xD8,0xD8,0xD8,
0xD8,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,
0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x80,
0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,0x00,
0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x06,0x06,
0x06,0x06,0x06,0x00,0x00,0x06,0x06,0x06,0xE6,0x66,0x20,0x00,0x06,0x06,0x86,0x06,
0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x86,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,
0x00,0x86,0x86,0x86,0x86,0x86,0x80,0x80,0x86,0x86,0x06,0x86,0x86,0xC0,0xC0,0x86,
0x86,0x86,0x06,0x06,0xD0,0x30,0x76,0x06,0x06,0x06,0x06,0x00,0x00,0x06,0x06,0x06,
0x06,0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x06,
0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x1C,0x00,0xFE,0x00,0x01,
0x02,0x00,0xC4,0x18,0x20,0x02,0x9E,0x63,0xB2,0x0E,0x00,0xFF,0x81,0x81,0xFF,0x00,
0x00,0x80,0x40,0x30,0x0F,0x00,0x00,0x00,0x00,0xFF,0x00,0x23,0xEA,0xAA,0xBF,0xAA,
0xEA,0x03,0x3F,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x0C,0x08,0x00,0x00,0x01,0x01,0x01,
0x01,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x81,0x80,0x80,0x81,0x80,
0x81,0x80,0x80,0x80,0x80,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x01,0x01,0x09,0x0C,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,
0x00,0x1E,0x21,0x40,0x40,0x50,0x21,0x5E,0x00,0x1E,0x21,0x40,0x40,0x50,0x21,0x5E,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC1,0xC1,0xFF,
0xFF,0xC1,0xC1,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x80,0xFC,0xF3,0xEF,0xF3,0xFC,
0x80,0xFF,0x80,0xEE,0xEE,0xEE,0xF5,0xFB,0xFF,0x9C,0xBE,0xB6,0xB6,0x88,0xFF,0x00
]
#像素:64*64
#列表大小:32*16
BMP2=[
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,
0x60,0x38,0x08,0x0C,0x06,0xC2,0xE2,0x33,0x11,0xF9,0x11,0x33,0x73,0xE2,0x06,0x04,
0x0C,0x18,0x30,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xF7,
0x00,0x00,0x00,0x00,0x00,0xC3,0x87,0x06,0x0C,0xFF,0x0C,0x18,0x18,0xF0,0xE0,0x00,
0x00,0x00,0x00,0x81,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x07,0x0C,0x18,0x30,0x30,0x61,0x63,0x46,0x46,0x5F,0x46,0x46,0x43,0x63,0x20,0x30,
0x18,0x0C,0x06,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0xE0,0xE0,0xF0,0xE0,0xE0,0xC0,0x60,0x70,0x30,0x38,0x18,0x18,0x0C,
0x0C,0x0C,0x66,0x66,0x66,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
0x66,0x66,0x0C,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0xE0,0xE0,0x70,0x38,0x18,0x0C,
0xFC,0xFC,0x1C,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xC7,0xFF,0x79,0x1B,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xC3,0xC3,0xC7,0x06,0x0C,0x18,0x70,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x83,0xFF,0x7F,0x00,0x00,
0x00,0x00,0x00,0x03,0x07,0xFE,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,
0xC0,0xC0,0x60,0x60,0x30,0x30,0x18,0x1C,0x0E,0x06,0x03,0x03,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x3F,0x78,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0xFE,0xFE,0x06,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,
0x1C,0x38,0xF0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xDC,0xFF,0xC3,0x01,0x01,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
]
#32-32.bmp
BMP3=[
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x0E,0x02,0x9B,0xBD,0xFF,0x65,0xED,0xCB,
0x06,0x9C,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x60,0x61,0x23,0xF6,0xFD,0x7F,0x7F,0x7B,0x7D,0xF4,
0xF6,0x23,0x60,0x60,0xC0,0xC0,0x60,0x60,0xE0,0x60,0x20,0x00,0x00,0x00,0x00,0x00,
0x20,0xFF,0x8F,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x1B,0x06,0x0C,0x18,0x90,0xF0,0x20,
0x00,0x01,0x1F,0x7E,0xE0,0x80,0x80,0xA0,0xF0,0x30,0x20,0x20,0x20,0x20,0x20,0x20,
0x60,0xC0,0x80,0x80,0xF0,0xF0,0x18,0x18,0x08,0x0C,0x04,0x06,0x03,0x01,0x01,0x00,
]
ssd1306.py
import utime as time
import codetab
# Constants
SSD1306_I2C_ADDRESS = 0x3C # 011110+SA0+RW - 0x3C or 0x3D
SSD1306_SETCONTRAST = 0x81
SSD1306_DISPLAYALLON_RESUME = 0xA4
SSD1306_DISPLAYALLON = 0xA5
SSD1306_NORMALDISPLAY = 0xA6
SSD1306_INVERTDISPLAY = 0xA7
SSD1306_DISPLAYOFF = 0xAE
SSD1306_DISPLAYON = 0xAF
SSD1306_SETDISPLAYOFFSET = 0xD3
SSD1306_SETCOMPINS = 0xDA
SSD1306_SETVCOMDETECT = 0xDB
SSD1306_SETDISPLAYCLOCKDIV = 0xD5
SSD1306_SETPRECHARGE = 0xD9
SSD1306_SETMULTIPLEX = 0xA8
SSD1306_SETLOWCOLUMN = 0x00
SSD1306_SETHIGHCOLUMN = 0x10
SSD1306_SETSTARTLINE = 0x40
SSD1306_MEMORYMODE = 0x20
SSD1306_COLUMNADDR = 0x21
SSD1306_PAGEADDR = 0x22
SSD1306_COMSCANINC = 0xC0
SSD1306_COMSCANDEC = 0xC8
SSD1306_SEGREMAP = 0xA0
SSD1306_CHARGEPUMP = 0x8D
SSD1306_EXTERNALVCC = 0x1
SSD1306_SWITCHCAPVCC = 0x2
# Scrolling constants
SSD1306_ACTIVATE_SCROLL = 0x2F
SSD1306_DEACTIVATE_SCROLL = 0x2E
SSD1306_SET_VERTICAL_SCROLL_AREA = 0xA3
SSD1306_RIGHT_HORIZONTAL_SCROLL = 0x26
SSD1306_LEFT_HORIZONTAL_SCROLL = 0x27
SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL = 0x29
SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL = 0x2A
class SSD1306Base(object):
def __init__(self, width, height):
self.width = width
self.height = height
self._pages = height//8
self._buffer = [0]*(width*self._pages)
# Handle hardware I2C
from driver import I2C
self._i2c=I2C()
self._i2c.open('OLED')
def _initialize(self):
raise NotImplementedError
def writeCmd(self, command):
"""Send command byte to display."""
# I2C write.
control = 0x00 # Co = 0, DC = 0
# writeBuf=bytearray(2)
# writeBuf[0]=control
# writeBuf[1]=command
# self._i2c.write(writeBuf)
writeBuf=bytearray(1)
writeBuf[0]=command
self._i2c.memWrite(writeBuf,control,8)
def writeDat(self, data):
"""Send byte of data to display."""
# I2C write.
control = 0x40 # Co = 0, DC = 0
# writeBuf=bytearray(2)
# writeBuf[0]=control
# writeBuf[1]=data
# self._i2c.write(writeBuf)
writeBuf=bytearray(1)
writeBuf[0]=data
self._i2c.memWrite(writeBuf,control,8)
def begin(self, vccstate=SSD1306_SWITCHCAPVCC):
"""Initialize display."""
# Save vcc state.
self._vccstate = vccstate
# Reset and initialize display.
# self.reset()
self._initialize()
# Turn on the display.
self.writeCmd(SSD1306_DISPLAYON)
# --------------------------------------------------------------
# Prototype : oled_fill(fill_data)
# Parameters : fill_data,范围0x00-0xff
# Description : 全屏填充,例如 0x00-全黑,0xff全亮
# --------------------------------------------------------------
def oled_fill(self,fill_data):
for i in range(8):
#page0-page1
self.writeCmd(0xb0+i)
# low colum start address
self.writeCmd(0x00)
#high colum start address
self.writeCmd(0x10)
for i in range(128*64):
self.writeDat(fill_data)
# --------------------------------------------------------------
# Prototype : clear()
# Parameters : none
# Description : 全黑
# --------------------------------------------------------------
def clear(self):
self.oled_fill(0x00)
# --------------------------------------------------------------
# Prototype : oled_setPos(x,y)
# Parameters : x,y -- 起始点坐标(x:0~127, y:0~7)
# Description : 设置起始坐标
# --------------------------------------------------------------
def oled_setPos(self,x,y):
self.writeCmd(0xb0+y)
self.writeCmd(((x&0xf0)>>4)|0x10)
self.writeCmd((x&0x0f)|0x01)
# --------------------------------------------------------------
# Prototype : oled_showCN(x,y,n)
# Parameters : x,y -- 起始点坐标(x:0~127, y:0~7); N:汉字在codetab.h中的索引
# Description : 显示codetab.py中的汉字,16*16点阵
# --------------------------------------------------------------
def oled_showCN(self,x,y,n):
self.oled_setPos(x,y)
adder=32*n
for i in range(16):
self.writeDat(codetab.F1[adder])
adder+=1
self.oled_setPos(x,y+1)
for i in range(16):
self.writeDat(codetab.F1[adder])
adder+=1
# --------------------------------------------------------------
# Prototype : oled_showStr(x,y,ch,TextSize)
# Parameters : x,y -- 起始点坐标(x:0~127, y:0~7); ch[] -- 要显示的字符串; TextSize -- 字符大小(1:6*8 ; 2:8*16)
# Description : 显示codetab.py中的ASCII字符,有6*8和8*16可选择
# --------------------------------------------------------------
def oled_showmun(self,x,y,ch,TextSize):
c=0
j=0
if TextSize==1:
while ch[j]!='\0':
#ord()将字符转换成十进制,如'a'->97
c=ch[j]-32
if x>126:
x=0
y+=1
self.oled_setPos(x,y)
for i in range(6):
self.writeDat(codetab.F6x8[c][i])
x+=6
j+=1
#防止index out of range
if j==len(ch):
break
if TextSize==2:
while ch[j]!='\0':
#ord()将字符转换成十进制
c=ch[j]-32
if x>120:
x=0
y+=1
self.oled_setPos(x,y)
for i in range(8):
self.writeDat(codetab.F8X16[c*16+i])
self.oled_setPos(x,y+1)
for i in range(8):
self.writeDat(codetab.F8X16[c*16+i+8])
x+=8
j+=1
#防止index out of range
if j==len(ch):
break
def oled_showstr(self,x,y,ch,TextSize):
c2=0
j=0
if TextSize==1:
while ch[j]!='\0':
#ord()将字符转换成十进制,如'a'->97
c2=ord(ch[j])-32
if x>126:
x=0
y+=1
self.oled_setPos(x,y)
for i in range(6):
self.writeDat(codetab.F6x8[c2][i])
x+=6
j+=1
#防止index out of range
if j==len(ch):
break
if TextSize==2:
while ch[j]!='\0':
#ord()将字符转换成十进制,如'a'->97
c2=ord(ch[j])-32
if x>120:
x=0
y+=1
self.oled_setPos(x,y)
for i in range(8):
self.writeDat(codetab.F8X16[c2*16+i])
self.oled_setPos(x,y+1)
for i in range(8):
self.writeDat(codetab.F8X16[c2*16+i+8])
x+=8
j+=1
#防止index out of range
if j==len(ch):
break
# # --------------------------------------------------------------
# Prototype : oled_showPicture(x0,y0,x1,y1,BMP)
# Parameters : x0,y0 -- 起始点坐标(x0:0~127, y0:0~7); x1,y1 -- 起点对角线(结束点)的坐标(x1:1~128,y1:128)
# Description : 显示BMP位图
# --------------------------------------------------------------
def oled_showPicture(self,x0,y0,x1,y1,BMP):
i=0
if y1%8==0:
y=y1/8
else:
y=y1/8+1
for y in range(y0,y1):
self.oled_setPos(x0,y)
for x in range(x0,x1):
self.writeDat(BMP[i])
i+=1
if i==len(BMP) :
break
# --------------------------------------------------------------
# Prototype : set_contrast(contrast)
# Parameters : coontrast,取值范围为0-255
# Description : 对比度/亮度调节
# --------------------------------------------------------------
def set_contrast(self, contrast):
if contrast < 0 or contrast > 255:
raise ValueError('Contrast must be a value from 0 to 255 (inclusive).')
self.writeCmd(SSD1306_SETCONTRAST)
self.writeCmd(contrast)
class SSD1306_128_64(SSD1306Base):
def __init__(self):
super(SSD1306_128_64, self).__init__(128, 64)
def _initialize(self):
# 128x64 pixel specific initialization.
self.writeCmd(SSD1306_DISPLAYOFF) # 0xAE
self.writeCmd(SSD1306_SETDISPLAYCLOCKDIV) # 0xD5
self.writeCmd(0x80) # the suggested ratio 0x80
self.writeCmd(SSD1306_SETMULTIPLEX) # 0xA8
self.writeCmd(0x3F)
self.writeCmd(SSD1306_SETDISPLAYOFFSET) # 0xD3
self.writeCmd(0x0) # no offset
self.writeCmd(SSD1306_SETSTARTLINE | 0x0) # line #0
self.writeCmd(SSD1306_CHARGEPUMP) # 0x8D
if self._vccstate == SSD1306_EXTERNALVCC:
self.writeCmd(0x10)
else:
self.writeCmd(0x14)
self.writeCmd(SSD1306_MEMORYMODE) # 0x20
self.writeCmd(0x00) # 0x0 act like ks0108
self.writeCmd(SSD1306_SEGREMAP | 0x1)
self.writeCmd(SSD1306_COMSCANDEC)
self.writeCmd(SSD1306_SETCOMPINS) # 0xDA
self.writeCmd(0x12)
self.writeCmd(SSD1306_SETCONTRAST) # 0x81
if self._vccstate == SSD1306_EXTERNALVCC:
self.writeCmd(0x9F)
else:
self.writeCmd(0xCF)
self.writeCmd(SSD1306_SETPRECHARGE) # 0xd9
if self._vccstate == SSD1306_EXTERNALVCC:
self.writeCmd(0x22)
else:
self.writeCmd(0xF1)
self.writeCmd(SSD1306_SETVCOMDETECT) # 0xDB
self.writeCmd(0x40)
self.writeCmd(SSD1306_DISPLAYALLON_RESUME) # 0xA4
self.writeCmd(SSD1306_NORMALDISPLAY) # 0xA6
class SSD1306_128_32(SSD1306Base):
def __init__(self):
super(SSD1306_128_32, self).__init__(128, 32)
def _initialize(self):
self.writeCmd(SSD1306_DISPLAYOFF) # 0xAE
self.writeCmd(SSD1306_SETDISPLAYCLOCKDIV) # 0xD5
self.writeCmd(0x80) # the suggested ratio 0x80
self.writeCmd(SSD1306_SETMULTIPLEX) # 0xA8
self.writeCmd(0x1F)
self.writeCmd(SSD1306_SETDISPLAYOFFSET) # 0xD3
self.writeCmd(0x0) # no offset
self.writeCmd(SSD1306_SETSTARTLINE | 0x0) # line #0
self.writeCmd(SSD1306_CHARGEPUMP) # 0x8D
if self._vccstate == SSD1306_EXTERNALVCC:
self.writeCmd(0x10)
else:
self.writeCmd(0x14)
self.writeCmd(SSD1306_MEMORYMODE) # 0x20
self.writeCmd(0x00) # 0x0 act like ks0108
self.writeCmd(SSD1306_SEGREMAP | 0x1)
self.writeCmd(SSD1306_COMSCANDEC)
self.writeCmd(SSD1306_SETCOMPINS) # 0xDA
self.writeCmd(0x02)
self.writeCmd(SSD1306_SETCONTRAST) # 0x81
self.writeCmd(0x8F)
self.writeCmd(SSD1306_SETPRECHARGE) # 0xd9
if self._vccstate == SSD1306_EXTERNALVCC:
self.writeCmd(0x22)
else:
self.writeCmd(0xF1)
self.writeCmd(SSD1306_SETVCOMDETECT) # 0xDB
self.writeCmd(0x40)
self.writeCmd(SSD1306_DISPLAYALLON_RESUME) # 0xA4
self.writeCmd(SSD1306_NORMALDISPLAY) # 0xA6
class SSD1306_96_16(SSD1306Base):
def __init__(self):
super(SSD1306_96_16, self).__init__(96, 16)
def _initialize(self):
self.writeCmd(SSD1306_DISPLAYOFF) # 0xAE
self.writeCmd(SSD1306_SETDISPLAYCLOCKDIV) # 0xD5
self.writeCmd(0x60) # the suggested ratio 0x60
self.writeCmd(SSD1306_SETMULTIPLEX) # 0xA8
self.writeCmd(0x0F)
self.writeCmd(SSD1306_SETDISPLAYOFFSET) # 0xD3
self.writeCmd(0x0) # no offset
self.writeCmd(SSD1306_SETSTARTLINE | 0x0) # line #0
self.writeCmd(SSD1306_CHARGEPUMP) # 0x8D
if self._vccstate == SSD1306_EXTERNALVCC:
self.writeCmd(0x10)
else:
self.writeCmd(0x14)
self.writeCmd(SSD1306_MEMORYMODE) # 0x20
self.writeCmd(0x00) # 0x0 act like ks0108
self.writeCmd(SSD1306_SEGREMAP | 0x1)
self.writeCmd(SSD1306_COMSCANDEC)
self.writeCmd(SSD1306_SETCOMPINS) # 0xDA
self.writeCmd(0x02)
self.writeCmd(SSD1306_SETCONTRAST) # 0x81
self.writeCmd(0x8F)
self.writeCmd(SSD1306_SETPRECHARGE) # 0xd9
if self._vccstate == SSD1306_EXTERNALVCC:
self.writeCmd(0x22)
else:
self.writeCmd(0xF1)
self.writeCmd(SSD1306_SETVCOMDETECT) # 0xDB
self.writeCmd(0x40)
self.writeCmd(SSD1306_DISPLAYALLON_RESUME) # 0xA4
self.writeCmd(SSD1306_NORMALDISPLAY) # 0xA6
board.json
{
"version": "2.0.0",
"io": {
"OLED": {
"type": "I2C",
"port": 1,
"addrWidth": 7,
"freq": 400000,
"mode": "master",
"devAddr": 60
},
"serial1":{
"type":"UART",
"port":0,
"dataWidth":8,
"baudRate":9600,
"stopBits":1,
"flowControl":"disable",
"parity":"none"
},
"KEY1": {
"type": "GPIO",
"port": 44,
"dir": "irq",
"pull": "pullup",
"intMode": "falling"
}
},
"debugLevel": "ERROR",
"repl": "enable",
"replPort": 2
}
调试
由于GPS模块连接TTL口进行通信,需要使用USB端口读取log,在设备管理器中找到port5对应串口。
串口调试工具log,运行后自动联网,连接阿里云平台,打印‘-----start-----’
- 第一次按下‘key1’按钮,打印‘=== call ===’,持续打印当前设备经纬度,并拨打电话
- 再次按下‘key1’按钮,打印‘----callend----’,挂断电话
POWERONREASON:0x0003,parse:,powerkey,pinReset.
网络连接成功
deviceSecretdict: 1c75b072be8c859df30ee8a20b3118f4
动态注册成功:1c75b072be8c859df30ee8a20b3118f4
{'deviceName': '**********', 'deviceSecret': '**********', 'region': 'cn-shanghai', 'productKey': '********', 'keepaliveSec': 60}
<I>UA uagent_ext_comm_init[63]: [uA]prepare start uagent comm a1laDtv9VrO 867082058699398
<I>UA uagent_ext_comm_init[74]: [uA]Subsrcibe TOPIC /sys/a1laDtv9VrO/867082058699398/_thing/service/invoke
<I>UA uagent_ext_comm_init[80]: [uA]IOT_MQTT_Subscribe(/sys/a1laDtv9VrO/867082058699398/_thing/service/invoke) success
<I>UA uagent_ext_comm_init[89]: [uA]IOT_MQTT_Subscribe(/sys/a1laDtv9VrO/867082058699398/_thing/service/post_reply) success
user log switch state is: 0
toggle it using the switch in device detail page in https://iot.console.aliyun.com
-----start-----
***** connect lp succeed****
MicroPython 334878468-dirty on 2022-08-16, 09:25:34; haas506 with M601
Type "help()" for more information.
['$GNRMC', '062415.000', 'A', '3116.36151', 'N', '12044.46546', 'E', '10.49', '224.32', '091122', '', '', 'A', 'V*3D']
lat: 31.2726918333333333
long: 120.741091
=== call ===
['$GNRMC', '062415.000', 'A', '3116.36151', 'N', '12044.46546', 'E', '10.49', '224.32', '091122', '', '', 'A', 'V*3D']
lat: 31.2726918333333333
long: 120.741091
['$GNRMC', '062415.000', 'A', '3116.36151', 'N', '12044.46546', 'E', '10.49', '224.32', '091122', '', '', 'A', 'V*3D']
lat: 31.2726918333333333
long: 120.741091
----callend----
voicecall holding, PhoneNO.:
['$GNRMC', '062415.000', 'A', '3116.36151', 'N', '12044.46546', 'E', '10.49', '224.32', '091122', '', '', 'A', 'V*3D']
lat: 31.2726918333333333
long: 120.741091
云端收到上传的位置数据
打入电话将自动应答,并在通话期间持续发送定位信息
物联网应用开发
以下是物联网应用开发流程,接下来按以下流程介绍移动端应用的开发。
3.1新建‘普通项目’
- 使用阿里云IoTStudio创建项目。
- 在项目管理新建空白项目
3.2关联产品和设备
3.3 新建web应用
3.4添加组件
3.5 保存 预览
地图上可以显示最近上传过的位置信息