【平头哥RVB2601创意应用开发】基于RISC-V的手势识别云音乐播放器
<ul><li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman",serif"><b><span style="font-size:16.0pt"><span style="background:white"><span style="font-family:"微软雅黑",sans-serif"><span style="color:black">项目背景</span></span></span></span></b></span></span></li>
</ul>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:black">由于RISC-V架构是一个开源、免费的架构,这几年确实受到了全球厂商们的关注和使用,目前RISC-V基金会成员已有超过2000家,覆盖了70个国家。像Intel这样的传统X86大厂都做出了违背祖宗的决定加入到RISC-V架构阵营中(收购SiFive),但大概是做一些智能驾驶汽车上使用的芯片。</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">它的优势在于免费、开源,甚至是可以让我们修改它的指令集,但是修改后的芯片就不符合RISC的标准,需要为其自定义名称。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">手势识别的应用场景广泛,结合物联网,可以实现在包括智能驾驶中操控汽车、游戏娱乐、AR/VR体验和培训等多种场景下的应用。在这些应用场景中,手势识别技术需要足够稳定和灵敏,才能为用户带来顺畅无阻的体验。此外,手势识别需要足够通用,可适应各种不同的环境和照明条件。在应用方面,与按键相比,手势识别无需眼睛找准按键方向,只需比划相应的手势即可执行相应的操作;与手柄相比,手势的优势在于使用更灵活,而且沉浸感更好,直接上手体验会比手柄按键更自然。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">阿里云物联网平台是一个集成了设备管理、数据安全通信和消息订阅等能力的一体化平台。向下支持连接海量设备,采集设备数据上云;向上提供云端API,服务端可通过调用云端API将指令下发至设备端,实现远程控制。利用WIFI通信,接入物联网平台,能实现云下发任务。</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"> </p>
<ul>
<li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman",serif"><span style="font-size:16.0pt"><span style="font-family:"微软雅黑",sans-serif">作品简介(100-200字)+作品照片</span></span></span></span></li>
</ul>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">本项目的名称为《基于RISC-V的手势识别云音乐播放器》,鉴于我非常喜欢听音乐,做个音乐播放器的小项目便在情理之中。之前只做过C51、STM32相关的音乐播放器,还从未接触过RISC-V架构。 由于平头哥和阿里的关系,阿里推出IOT物联网平台,结合物联网应用,做一款基于CH2601的手势识别云音乐播放器是一件很有实际意义的事情。正好平头哥搞了活动,于是果断申请,过了几周就批准了。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">RISC-V</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">正处于发展初期,各种外部模块的驱动程序急需适配。为了减少引脚使用,决定选用PAJ7620U2手势识别模块,而PAJ7620在RVB2601开发板上还没有例程,对应于CH2601芯片的驱动也没有现成的可用,只能自己移植。对于12864显示屏,由于lvgl我也不太会用,于是移植了ssd1306的相关驱动并实现了音乐信息的显示。为了减轻处理器的压力,还自行编写了PHP接口,使用PHP远程获取音乐文件的相关信息,可以分别在云平台和RVB2601的显示屏上显示。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">最终,我完成了以下任务:实现了音乐播放器的完整功能;不同手势控制播放器的播放进程、音量大小等基本操作;自行编写了2个API接口用于获得歌曲的长度、码率等信息;实现阿里云平台调用自定义API接口并下发到RVB2601;实现了阿里云平台下发控制不同命令到RVB2601并执行相应操作控制播放进程;移植了PAJ7620系列驱动和SSD1306驱动,使其支持CH2601芯片;阿里IOT云平台的布局(对应逻辑功能全部实现)等。</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left; text-indent:21.0pt"> </p>
<ul>
<li style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman",serif"><span style="font-size:16.0pt"><span style="font-family:"微软雅黑",sans-serif">系统框图</span></span></span></span></li>
</ul>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">PAJ7620</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">模块与CH2601芯片之间的连接如图13,VCC与GND分别对应芯片引脚上的VCC和GND,SCL和SDA分别对应芯片引脚上的PA7和PA26。</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><v:rect id="Rectangle_x0020_36" o:gfxdata="UEsDBBQABgAIAAAAIQC2gziS/gAAAOEBAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbJSRQU7DMBBF
90jcwfIWJU67QAgl6YK0S0CoHGBkTxKLZGx5TGhvj5O2G0SRWNoz/78nu9wcxkFMGNg6quQqL6RA
0s5Y6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vRD1
6brHEN8rsCwZDUcaWoYXu4cQUzmiPqXkOsHodqWNyQ5u1ncG2U7QgFd5pZnSlXCZZhwbGj67mpYZ
+ZdYuIQo8/obhNWRlGq0bfj8nCTqXon2nWuzjqLQ5mDT+8al+lTW4LGPE5NJnaFeQ/tMrCIcREmf
iIwe8AdnAwmy4eH7VqDizHxwNPGbajJJCs7OZHo9JgcvI+vLiHCSoBoeOTuYd/Gg+q1HvenppSoz
4eAtTbPTmeeXqo4aINFlLo8fJKn60s9ZL994+RMAAP//AwBQSwMEFAAGAAgAAAAhACpkDaDhAAAA
CgEAAA8AAABkcnMvZG93bnJldi54bWxMj8FOwzAQRO9I/IO1SFwQtWua0IY4FUKityIoCK5uvCQp
9jqK3Tbl6zEnOK7maeZtuRydZQccQudJwXQigCHV3nTUKHh7fbyeAwtRk9HWEyo4YYBldX5W6sL4
I73gYRMblkooFFpBG2NfcB7qFp0OE98jpezTD07HdA4NN4M+pnJnuRQi5053lBZa3eNDi/XXZu8U
ZO+7q+/n1XolP9Yy3+WL7knYk1KXF+P9HbCIY/yD4Vc/qUOVnLZ+TyYwq2C2kLOEpuBmCiwBtzLP
gG0VSDHPgFcl//9C9QMAAP//AwBQSwECLQAUAAYACAAAACEAtoM4kv4AAADhAQAAEwAAAAAAAAAA
AAAAAAAAAAAAW0NvbnRlbnRfVHlwZXNdLnhtbFBLAQItABQABgAIAAAAIQA4/SH/1gAAAJQBAAAL
AAAAAAAAAAAAAAAAAC8BAABfcmVscy8ucmVsc1BLAQItABQABgAIAAAAIQDB1xUFBAIAAA4EAAAO
AAAAAAAAAAAAAAAAAC4CAABkcnMvZTJvRG9jLnhtbFBLAQItABQABgAIAAAAIQAqZA2g4QAAAAoB
AAAPAAAAAAAAAAAAAAAAAF4EAABkcnMvZG93bnJldi54bWxQSwUGAAAAAAQABADzAAAAbAUAAAAA
" strokeweight=".5pt" style="position:absolute; left:0; text-align:left; margin-left:328px; margin-top:9px; width:117.05pt; height:97.7pt; z-index:251629568"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AsC
AAAeBAAADgAAAAAAAAAAAAAAAAAuAgAAZHJzL2Uyb0RvYy54bWxQSwECLQAUAAYACAAAACEA19E7
w+EAAAAKAQAADwAAAAAAAAAAAAAAAABlBAAAZHJzL2Rvd25yZXYueG1sUEsFBgAAAAAEAAQA8wAA
AHMFAAAAAA==
" strokeweight=".5pt" style="position:absolute; left:0; text-align:left; margin-left:99px; margin-top:43px; width:65.75pt; height:58.2pt; z-index:251630592"></v:rect></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">本项目是以例程现有的网络播放器项目为基础改造而成,增加了手势识别控制,OLED显示歌曲信息,连接阿里云物联网平台和物联网平台下发命令等功能。下面我将逐一说明每一个功能实现的要点和关键代码。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">首先说手势识别控制,手势识别模块选用了PAJ7620模块,支持9种手势,通过IIC协议与主机通信。初始化PAJ7620我使用了两个文件,分别是myi2c.c和paj7620.c,myi2c主要是初始IIC协议,使用的方法就是引脚软件模拟IIC,函数具体就不列出,可以参考stm32下的代码,这里主要修改了头文件中的操作定义,</span></span></span></span></span></span></span></span></p>
<p style="text-align:justify; text-indent:21pt"> </p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">编写完myi2c.c文件,我们的paj7620基本就初始化完成一半了。Paj7620的初始化函数不算太难,首先调用前面编写的IIC初始化函数,之后唤醒paj7620(向其传送一些信号),若唤醒不成功则返回0,如果唤醒成功就继续执行初始化操作,即向PAJ7620寄存器内写入初始化数组。初始化成功后,便会打印出成功字样并返回1。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">在这之后,就可以正式编写手势识别代码了,在这里我使用的有返回值的函数,可以根据返回不同的值执行对应的操作,函数的核心是运用前面编写在myi2c.c中的GS_ReadnByte()函数读取寄存器中的值。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">最后一步即使调用手势识别函数,我们在sdk自带的函数player.c中的相应部分调用这个函数即可(我是直接将函数写在了对应处)。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">在这里,我把播放相关的操作封装到了PlayControl()函数里,若要对播放实例进行控制操作,只需要在参数中增加相应参数即可。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">在这里一并附上获取音量函数、获取音乐名函数和获取云平台上传入的URL函数(这个函数是为了在OLED上显示文件名而编写的)。获取音乐名函数就是获取URL中的文件名。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">第二说说SSD1306驱动12864屏幕,这个社区有了一篇文章,具体就不细说,也是移植来的(因为本人毕业设计就使用了SSD1306的0.96OLED显示屏),在原有基础上增加了ssd1306驱动OLED显示屏并显示歌曲的歌曲名称、当前时长、总时长、码率、音量大小等等。所以在这里只说说与STM32的不一样的地方。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">在这一块主要用了这两个函数,第一个是OLED初始化函数,第二个则是更新屏幕显示函数。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="150%"><span style="font-family:宋体">初始化函数由四部分组成,前两部分是初始化引脚功能和通信协议,与</span></span></span><span lang="EN-US" style="font-size:12.0pt"><span style="150%">STM32</span></span><span style="font-size:12.0pt"><span style="150%"><span style="font-family:宋体">的区别主要在语法方面有差异。</span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">做完上述工作后,就真正进入到了OLED的初始化阶段,这一部分的函数编写可以完全参照STM32下的驱动:</span></span></span></span></span></span></span></span></p>
<p style="text-indent:24.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">关键来了,本设计的所有显示都是调用ssd1306_screen_update()这个函数,写入数据分三步曲,第一步将数据放入数组内,第二步选择写入的行坐标,第三步调用WriteString()函数,写入到OLED缓存中。一屏数据写好后,调用UpdateScreen()函数刷新整屏,这样就能在12864屏幕上显示我们需要的数据了。其中timer2是根据计算得到的当前播放到的秒数,getDutation()函数是获取到的歌曲的秒数,getKbps函数()是获取到的码率。这三个数据都与IOT平台有关,故在此不多加赘述。</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left; text-indent:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"> <span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">第三,IOT平台的调用问题,也就是连接阿里云物联网平台和物联网平台下发命令。关于这个问题,平头哥社区有篇文章,是基于网络播放器项目的,大家可以参考。这个函数就是从WiFi接收到IOT平台的发送请求后需要调用的,请求函数写在了w800_api中。在这个函数里我要求云平台要给出三个数据,分别是播放总长度,码率和播放地址。给出播放地址后马上就转入播放了,故要先获得前两个数据。</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left; text-indent:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"> <span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">由于每次只能获取一个参数,如果不加if判断就会导致传参错误,最终导致死机。经过我的长时间测试,得到一种方法:在机器中预先定义一个布尔型变量用于了解是否需要更新数据,在云平台也定义这个变量。当需要对这个数据更新时,先传输这个布尔型变量使其变成真,再向机器传输第二次数据,将需要更新的数据更新进来,同时将布尔型变量变成假,就巧妙地解决了死机的问题。</span></span></span></span></span></span></span></span></p>
<p align="left" style="text-align:left; text-indent:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"> <span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">接收代码如下框所示,这是一个具体的例子,可以参考一下。</span></span></span></span></span></span></span></span></p>
<div style="border:solid windowtext 1.0pt; padding:1.0pt 1.0pt 1.0pt 1.0pt">
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">int iot_apply(char *strbuff)</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">{</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> //printf("SDSDSD %d\n",SongDuration);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> strcpy((char *)buff_accept,strbuff); </span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> str_json = cJSON_Parse((char *)buff_accept); //</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">创建JSON解析对象,返回JSON格式是否正确</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(str_json == NULL)</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> {</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> LOGI(TAG"error:%s;\r\n",cJSON_GetErrorPtr());</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> cJSON_Delete(str_json);//</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">释放内存 </span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> return -1;</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> else</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> {</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(trans_Kbps==true){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> trans_Kbps=false;</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> str_value = cJSON_GetObjectItem(str_json, "Kbps");</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> Kbps = atoi(str_value->valuestring);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(trans_duration==true){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> trans_duration=false;</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> str_value = cJSON_GetObjectItem(str_json, "SongDuration");</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> SongDuration = atoi(str_value->valuestring);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> //printf("theDuration:%d\n",getDuration);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(trans_url==true){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> trans_url=false;</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> str_value = cJSON_GetObjectItem(str_json, "PlayURL");</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> //LOGI(TAG,"PlayURL</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">:%s;\r\n",str_value->valuestring);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> URLPlay(str_value->valuestring);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> str_value = cJSON_GetObjectItem(str_json, "VolumeControl");</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> //LOGI(TAG,"VolumeControl</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">:%d;\r\n",str_value->valueint);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(str_value->valueint==0){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> PlayControl(2);//</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">降低音量</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(str_value->valueint==1){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> PlayControl(1);//</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">增加音量</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> str_value = cJSON_GetObjectItem(str_json, "MusicPlayControl");</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> //LOGI(TAG,"MusicPlayControl</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">:%d;\r\n",str_value->valueint);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(str_value->valueint==0){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> //iot_upload(2);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> PlayControl(6);//</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">播放</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(str_value->valueint==1){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> //iot_upload(3);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> PlayControl(7);//</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">暂停</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(str_value->valueint==4){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> //iot_upload(0);</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> PlayControl(8);//</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">停止</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> str_value = cJSON_GetObjectItem(str_json, "DataRequest");</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(str_value->valueint==0){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> trans_duration=true;</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(str_value->valueint==1){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> trans_url=true;</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> if(str_value->valueint==2){</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> trans_Kbps=true;</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> cJSON_Delete(str_json);//</span></span></span></span></span><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">释放内存 </span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">//printf("theDuration:%d\n",SongDuration); </span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> return 1;</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:24.0pt; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"> }</span></span></span></span></span></span></span></span></p>
<p align="left" style="border:none; text-align:left; text-indent:0cm; padding:0cm"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">}</span></span></span></span></span></span></span></span></p>
</div>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman",serif"><span style="font-size:16.0pt"><span style="font-family:"微软雅黑",sans-serif">五、作品源码</span></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><b><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">1.RVB2601</span></span></span></span></span></b><b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">源码:</span></span></span></span></span></b></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">蓝奏云下载:<a href="https://wwp.lanzouj.com/iGWIy04jn3ej" style="color:#0563c1; text-decoration:underline">https://wwp.lanzouj.com/iGWIy04jn3ej</a> 密码:7cvk</span></span></span></span></span></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">百度云下载:链接: <a href="https://pan.baidu.com/s/1EzUWKtomTJxBvoAn3XXOWA" style="color:#0563c1; text-decoration:underline">https://pan.baidu.com/s/1EzUWKtomTJxBvoAn3XXOWA</a> 提取码: uwac </span></span></span></span></span></span></span></span></p>
<p style="text-indent:15.8pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><b><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">2.PHP</span></span></span></span></span></b><b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">自定义API接口源码</span></span></span></span></span></b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">:</span></span></span></span></span></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">蓝奏云<span style="150%"><span style="font-family:宋体"><span style="font-weight:normal">下载:<a href="https://wwp.lanzouj.com/iUGQo04jng4h" style="color:#0563c1; text-decoration:underline">https://wwp.lanzouj.com/iUGQo04jng4h</a> 密码:36u7</span></span></span></span></span></span></span></span></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"><span style="font-weight:normal">百度云下载: <a href="https://pan.baidu.com/s/1LpAUyx9Nf1UVBMTzKM3E1g" style="color:#0563c1; text-decoration:underline">https://pan.baidu.com/s/1LpAUyx9Nf1UVBMTzKM3E1g</a> 提取码: f46e </span></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman",serif"><b><span style="font-size:16.0pt"><span style="font-family:"微软雅黑",sans-serif">六、视频<span style="font-family:"微软雅黑",sans-serif">演示</span></span></span></b></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><b><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">1.</span></span></span></span></span></b><b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">手势识别控制效果展示:</span></span></span></span></span></b></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">哔哩哔哩:<a href="https://www.bilibili.com/video/BV1ir4y1t7Do/" style="color:#0563c1; text-decoration:underline">https://www.bilibili.com/video/BV1ir4y1t7Do/</a></span></span></span></span></span></span></span></span></p>
<p style="text-indent:15.8pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><b><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">2.</span></span></span></span></span></b><b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">阿里云物联网平台控制效果展示</span></span></span></span></span></b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">:</span></span></span></span></span></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">哔哩哔哩<span style="150%"><span style="font-family:宋体"><span style="font-weight:normal">:<a href="https://www.bilibili.com/video/BV1ou411r79q/" style="color:#0563c1; text-decoration:underline">https://www.bilibili.com/video/BV1ou411r79q/</a></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="text-indent:0cm; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><b><span style="font-size:16.0pt"><span style="150%"><span style="font-family:"微软雅黑",sans-serif">七、项目总结</span></span></span></b></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><b><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">1.</span></span></span></span></span></b><b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">总结:</span></span></span></span></span></b></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><b> </b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">关于总结,第一便是基本功不扎实。由于本身是学计算机出身,嵌入式对于我来说是弱项。比如IIC协议的原理,SPI协议的原理等理解的不到位,但在这种情况下依然把PAJ7620的驱动移植到ch2601,让我的学习兴趣变得更加浓厚了。在后续的学习过程中要继续夯实基础,加深对基础性问题的认识,把相应的原理弄透弄扎实。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"> <span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">第二,对于阿里云平台不是很熟练。这个平台在我使用的过程中还是存在一些问题,最大的问题是文档和例子很匮乏,很多东西都要自己摸索,极为浪费时间。其次是平台的一些功能待改进,比如添加按钮的操作最好可以直接复制其他按钮的操作而不是每次都要重新配置,按钮绑定功能误删后即使平台存在撤销恢复功能也不能够恢复等等问题,还有一些细节问题不再赘述。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"> <span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">第三,对于RVB2601本身而言,个人感觉还是非常不错的,性能足够强劲,上手也很容易。唯一不足可能就是现在刚刚起步,资料、例程较为缺乏,希望厂商能够想办法让更多的开发者投入到这一平台中,逐渐构建一个更好更强大的生态环境。</span></span></span></span></span></span></span></span></p>
<p style="text-indent:15.8pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><b><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">2.</span></span></span></span></span></b><b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">帖子分享链接汇总</span></span></span></span></span></b><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">:</span></span></span></span></span></span></span></span></p>
<ol>
<li style="margin-left:9px; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222">第一次上手,成功运行hello world!项目记<span style="150%"><span style="font-family:宋体"><span style="font-weight:normal">:</span></span></span></span></span></span></span></span></span></span></span></li>
</ol>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"><span style="font-weight:normal"><a href="https://bbs.eeworld.com.cn/thread-1199598-1-1.html" style="color:#0563c1; text-decoration:underline">https://bbs.eeworld.com.cn/thread-1199598-1-1.html</a></span></span></span></span></span></span></span></span></span></p>
<ol>
<li style="margin-left:9px; text-align:justify" value="2"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"><span style="font-weight:normal">为webplayer播放例程增加串口调节音量:</span></span></span></span></span></span></span></span></span></li>
</ol>
<p style="text-indent:15.7pt; text-align:justify"><span style="font-size:10.5pt"><span style="150%"><span style="font-family:"Times New Roman",serif"><span lang="EN-US" style="font-size:12.0pt"><span style="background:white"><span style="150%"><span style="font-family:宋体"><span style="color:#222222"><span style="font-weight:normal"><a href="https://bbs.eeworld.com.cn/thread-1201357-1-1.html" style="color:#0563c1; text-decoration:underline">https://bbs.eeworld.com.cn/thread-1201357-1-1.html</a></span></span></span></span></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman",serif"><b><span style="font-size:16.0pt"><span style="font-family:"微软雅黑",sans-serif">八、其他</span></span></b></span></span></p>
<p style="text-indent:15.7pt; text-align:justify"></p>
<p style="text-indent:13.75pt; text-align:justify"><br />
<br />
</p>
<p>这个厉害了</p> 终于完成作品了,恭喜呀,我还有努力中。难呀! lugl4313820 发表于 2022-5-10 15:51
终于完成作品了,恭喜呀,我还有努力中。难呀!
<p>加油!~~~~~~~~~~~~~~~</p>
<p><img height="48" src="https://bbs.eeworld.com.cn/static/editor/plugins/hkemoji/sticker/facebook/congra.gif" width="48" />学习了!</p>
<p>这个阿里云开发WEB端怎么样呀?</p>
梦溪开物 发表于 2022-5-11 10:33
这个阿里云开发WEB端怎么样呀?
<p>个人感觉灵活性还有点欠缺,比如变量转换方面和组件数据源来源方面可能还需要提高,但是依托阿里云,服务的稳定性是值得肯定的。</p>
<p>看了视频,效果不错,最近好多人都用手势传感器呀!</p>
你这个比我高明到不知道哪去了,我就是怎么简单怎么来。能动手指的,就不用挥舞胳膊。https://bbs.eeworld.com.cn/thread-1205044-1-1.html#pid3147769
页:
[1]