差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
wm_wiki:arduino_ide:api_document [2019/05/14 21:03] juneral [2. 单路巡线传感器API] |
wm_wiki:arduino_ide:api_document [2019/05/15 14:34] juneral [MP3模块API] |
||
---|---|---|---|
行 306: | 行 306: | ||
<p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
- | <p class=MsoNormal><span style='font-size:16.0pt'> </span></p> | + | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>编程示例:</span></p> |
</body></html> | </body></html> | ||
+ | |||
+ | <sxh c/c++; first-line: 1;highlight: [50,100]; title: ultrasonic_test.ino> | ||
+ | #include "WeELF328P.h" | ||
+ | |||
+ | WeUltrasonicSensor ultraSensor(PORT_B); | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | Serial.begin(9600); | ||
+ | } | ||
+ | void loop() | ||
+ | { | ||
+ | ultraSensor.setColor(1,0,20,0); //(Red,Green,Blue) | ||
+ | ultraSensor.setColor(2,20,0,0); //(Red,Green,Blue) | ||
+ | |||
+ | Serial.print("Distance : "); | ||
+ | Serial.print(ultraSensor.distanceCm() ); | ||
+ | Serial.println(" cm"); | ||
+ | delay(100); | ||
+ | } | ||
+ | </sxh> | ||
+ | \\ | ||
===== 巡线传感器API ===== | ===== 巡线传感器API ===== | ||
行 454: | 行 476: | ||
style='font-size:14.0pt'>0~1023</span></p> | style='font-size:14.0pt'>0~1023</span></p> | ||
- | <p class=MsoNormal align=left style='text-align:left;background:white'><span | + | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>编程示例:</span></p> |
- | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></p> | + | |
</body></html> | </body></html> | ||
+ | <sxh c/c++; first-line: 1;highlight: [50,100]; title: linfollower_test.ino> | ||
+ | #include "WeELF328P.h" | ||
+ | |||
+ | WeLineFollower lineFollower(PORT_A); | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | Serial.begin(9600); | ||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | uint16_t s1,s2; | ||
+ | s1=lineFollower.startRead(1); | ||
+ | s2=lineFollower.startRead(2); | ||
+ | Serial.print("S1="); | ||
+ | Serial.println(s1); | ||
+ | Serial.print("S2="); | ||
+ | Serial.println(s2); | ||
+ | delay(100); | ||
+ | } | ||
+ | </sxh> | ||
+ | \\ | ||
==== 2. 单路巡线传感器API ==== | ==== 2. 单路巡线传感器API ==== | ||
行 483: | 行 527: | ||
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
- | style='border-collapse:collapse'> | + | style='border-collapse:collapse;mso-yfti-tbllook:1184;mso-padding-alt:0in 0in 0in 0in'> |
- | <tr style='height:25.6pt'> | + | <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes; |
+ | height:25.6pt'> | ||
<td valign=top style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | <td valign=top style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | ||
height:25.6pt'> | height:25.6pt'> | ||
行 490: | 行 535: | ||
color:#0080FF'>port</span></b></p> | color:#0080FF'>port</span></b></p> | ||
</td> | </td> | ||
- | <td width=822 valign=top style='width:616.4pt;border:solid windowtext 1.0pt; | + | <td width=924 valign=top style='width:692.9pt;border:solid windowtext 1.0pt; |
border-left:none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | border-left:none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | ||
<p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | ||
行 529: | 行 574: | ||
</body></html> | </body></html> | ||
- | <sxh c/c++; first-line: 1;highlight: [89,92]; title: slf_test.ino> | + | <sxh c/c++; first-line: 1;highlight: [50,100]; title: slf_test.ino> |
#include<WeELF328P.h> | #include<WeELF328P.h> | ||
行 546: | 行 591: | ||
} | } | ||
</sxh> | </sxh> | ||
+ | \\ | ||
===== LED表情面板模块API ===== | ===== LED表情面板模块API ===== | ||
+ | |||
+ | ===== MP3模块API ===== | ||
+ | |||
+ | <html><body> | ||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>class</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>WeMP3</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:</span><span | ||
+ | style='font-size:14.0pt;font-family:等线'>MP3<span lang=ZH-CN>模块类名定义</span></span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>其可直接调用的成员函数如下:</span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(1)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> <span style='color:#0080FF'>WeMP3</span><span | ||
+ | style='color:black'>(</span><span style='color:#8000FF'>uint8_t</span></span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>port</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>=</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:red'>0</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:构造函数,在定义</span><span | ||
+ | style='font-size:14.0pt;font-family:等线'>MP3<span lang=ZH-CN>类时可定义接口</span></span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:</span></p> | ||
+ | |||
+ | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
+ | style='border-collapse:collapse'> | ||
+ | <tr style='height:25.6pt'> | ||
+ | <td valign=center style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | ||
+ | height:25.6pt'> | ||
+ | <p class=MsoNormal><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | color:#0080FF'>port</span></b></p> | ||
+ | </td> | ||
+ | <td width=330 valign=center style='width:247.4pt;border:solid windowtext 1.0pt; | ||
+ | border-left:none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | ||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | ||
+ | color:windowtext'>选择端口,如</span><span style='font-size:14.0pt;color:windowtext'>PORT_A,PORT_1</span><span | ||
+ | lang=ZH-CN style='font-size:14.0pt;font-family:等线;color:windowtext'>等</span></p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>示例:</span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>WeMP3</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'> mp3(PORT_A);</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>备注:在定义类时,可以不直接传入</span><span | ||
+ | style='font-size:14.0pt'>port</span><span lang=ZH-CN style='font-size:14.0pt; | ||
+ | font-family:等线'>的值</span><span style='font-size:14.0pt'>(</span><span | ||
+ | lang=ZH-CN style='font-size:14.0pt;font-family:等线'>初值为</span><span | ||
+ | style='font-size:14.0pt'>0)</span><span lang=ZH-CN style='font-size:14.0pt; | ||
+ | font-family:等线'>,可之后设置:</span></p> | ||
+ | |||
+ | <p class=MsoNormal style='margin-left:.5in'><b><span style='font-size:16.0pt; | ||
+ | font-family:"Courier New";color:#0080FF'>WeMP3</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'> mp3;</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>之后调用:</span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>mp3.reset(PORT_A);</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal> </p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(2)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'> void</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>reset</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>(</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>uint8_t</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>port</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>=</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:red'>0</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:可重新设置接口</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:</span></p> | ||
+ | |||
+ | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
+ | style='border-collapse:collapse'> | ||
+ | <tr style='height:25.6pt'> | ||
+ | <td valign=center style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | ||
+ | height:25.6pt'> | ||
+ | <p class=MsoNormal><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | color:#0080FF'>port</span></b></p> | ||
+ | </td> | ||
+ | <td width=330 valign=center style='width:247.4pt;border:solid windowtext 1.0pt; | ||
+ | border-left:none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | ||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | ||
+ | color:windowtext'>选择端口,如</span><span style='font-size:14.0pt;color:windowtext'>PORT_A,PORT_1</span><span | ||
+ | lang=ZH-CN style='font-size:14.0pt;font-family:等线;color:windowtext'>等</span></p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span style='font-size:10.0pt;font-family:等线'> </span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(3)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>appointDevice</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>(</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>uint8_t</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>devtype</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>);</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:设置曲目播放来源,内置</span><span | ||
+ | style='font-size:14.0pt;font-family:等线'>FLASH<span lang=ZH-CN>或</span>TF<span | ||
+ | lang=ZH-CN>卡</span></span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:</span></p> | ||
+ | |||
+ | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
+ | style='border-collapse:collapse'> | ||
+ | <tr style='height:25.6pt'> | ||
+ | <td valign=center style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | ||
+ | height:25.6pt'> | ||
+ | <p class=MsoNormal><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | color:#0080FF'>devtype</span></b></p> | ||
+ | </td> | ||
+ | <td width=399 valign=center style='width:299.6pt;border:solid windowtext 1.0pt; | ||
+ | border-left:none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | ||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | ||
+ | color:windowtext'>选择播放文件来源,</span><span style='font-size:14.0pt;font-family: | ||
+ | 等线;color:windowtext'>2<span lang=ZH-CN>为</span>TF<span lang=ZH-CN>卡,</span>4<span | ||
+ | lang=ZH-CN>为内置</span>FLASH</span></p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal> </p> | ||
+ | |||
+ | <p class=MsoNormal><b><span style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(4)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>appointVolume</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>(</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>uint8_t</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>volume</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:设置播放音量</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:</span></p> | ||
+ | |||
+ | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
+ | style='border-collapse:collapse'> | ||
+ | <tr style='height:25.6pt'> | ||
+ | <td valign=center style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | ||
+ | height:25.6pt'> | ||
+ | <p class=MsoNormal><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | color:#0080FF'>volume</span></b></p> | ||
+ | </td> | ||
+ | <td width=298 valign=center style='width:223.7pt;border:solid windowtext 1.0pt; | ||
+ | border-left:none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | ||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | ||
+ | color:windowtext'>音量值,范围(</span><span style='font-size:14.0pt;font-family: | ||
+ | 等线;color:windowtext'>0~30<span lang=ZH-CN>)</span></span></p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'> </p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(5)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>appointMusic</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>(</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>uint16_t</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>num</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:指定播放第几首</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:</span></p> | ||
+ | |||
+ | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
+ | style='border-collapse:collapse'> | ||
+ | <tr style='height:25.6pt'> | ||
+ | <td valign=center style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | ||
+ | height:25.6pt'> | ||
+ | <p class=MsoNormal><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | color:#0080FF'>num</span></b></p> | ||
+ | </td> | ||
+ | <td width=298 valign=center style='width:223.7pt;border:solid windowtext 1.0pt; | ||
+ | border-left:none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | ||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | ||
+ | color:windowtext'>选择第几首,范围(</span><span style='font-size:14.0pt;font-family: | ||
+ | 等线;color:windowtext'>0~3000<span lang=ZH-CN>)</span></span></p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'> </p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(6)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>play</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>(</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:播放</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'> </span></b></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(7)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>pause</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>(</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:暂停播放</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(8)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>prevMusic</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>(</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:上一首</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span style='font-size:10.0pt;font-family:等线'> </span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(9)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>nextMusic</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>(</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:下一首</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal> </p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><span | ||
+ | style='font-size:16.0pt'> </span><b><span style='font-size:12.0pt; | ||
+ | font-family:"News Gothic MT",sans-serif'>(10)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>uint8_t</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>isOver</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>(</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'>void</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><span | ||
+ | lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:判断当前曲目是否播放完毕</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:</span><span | ||
+ | style='font-size:14.0pt;font-family:等线'>1<span lang=ZH-CN>表示播放完毕,</span>0<span | ||
+ | lang=ZH-CN>表示未播放完</span></span></p> | ||
+ | </body></html> | ||
+ | |||
+ | <sxh c/c++; first-line: 1;highlight: [50,100]; title: mp3_test.ino> | ||
+ | #include "WeELF328P.h" | ||
+ | |||
+ | WeMP3 mp3(PORT_A); | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | mp3.appointVolume(20); //Volume 0~23 | ||
+ | mp3.appointDevice(4); //2-TF; 4-FLASH | ||
+ | mp3.appointMusic(1); //0~3000 | ||
+ | } | ||
+ | void loop() | ||
+ | { | ||
+ | if(mp3.isOver()==1) | ||
+ | { | ||
+ | mp3.nextMusic(); | ||
+ | } | ||
+ | } | ||
+ | </sxh> | ||
+ | \\ | ||
+ | |||
+ | ===== 电子指南针传感器API ===== | ||
+ | |||
+ | <html><body> | ||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman"; | ||
+ | color:#8000FF'>class</span></b><span style='font-size:10.0pt;font-family:"Courier New"; | ||
+ | mso-fareast-font-family:"Times New Roman";color:black'> </span><span | ||
+ | class=SpellE><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | mso-fareast-font-family:"Times New Roman";color:#0080FF'>WeCompassSensor</span></b></span><span | ||
+ | style='font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-font-family: | ||
+ | "Times New Roman"'><o:p></o:p></span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:电子罗盘传感器类名定义</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>其可直接调用的成员函数如下:</span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(1)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><span | ||
+ | class=SpellE><span class=GramE><b><span style='font-size:16.0pt;font-family: | ||
+ | "Courier New";mso-fareast-font-family:"Times New Roman";color:#0080FF'>WeCompassSensor</span></b></span></span><span | ||
+ | class=GramE><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | color:black'>(</span></b></span><b><span style='font-size:16.0pt;font-family: | ||
+ | "Courier New";color:#8000FF'>uint8_t</span></b><span style='font-size:10.0pt; | ||
+ | font-family:"Courier New";color:black'> </span><b><span style='font-size:16.0pt; | ||
+ | font-family:"Courier New";color:#0080FF'>port</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>=</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:red'>0</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:构造函数,在定义电子罗盘传感器类时可定义接口</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:</span></p> | ||
+ | |||
+ | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
+ | style='border-collapse:collapse;mso-yfti-tbllook:1184;mso-padding-alt:0in 0in 0in 0in'> | ||
+ | <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes; | ||
+ | height:25.6pt'> | ||
+ | <td style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | ||
+ | height:25.6pt'> | ||
+ | <p class=MsoNormal><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | color:#0080FF'>port</span></b></p> | ||
+ | </td> | ||
+ | <td width=330 style='width:247.4pt;border:solid windowtext 1.0pt;border-left: | ||
+ | none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | ||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | ||
+ | color:windowtext'>选择端口,如</span><span style='font-size:14.0pt;color:windowtext'>PORT_A,PORT_1</span><span | ||
+ | lang=ZH-CN style='font-size:14.0pt;font-family:等线;color:windowtext'>等</span></p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>示例:</span><span | ||
+ | class=SpellE><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | mso-fareast-font-family:"Times New Roman";color:#0080FF'>WeCompassSensor</span></b></span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'> <span | ||
+ | class=GramE>compass(</span>PORT_A);</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>备注:在定义类时,可以不直接传入</span><span | ||
+ | style='font-size:14.0pt'>port</span><span lang=ZH-CN style='font-size:14.0pt; | ||
+ | font-family:等线'>的值</span><span style='font-size:14.0pt'>(</span><span | ||
+ | lang=ZH-CN style='font-size:14.0pt;font-family:等线'>初值为</span><span | ||
+ | style='font-size:14.0pt'>0)</span><span lang=ZH-CN style='font-size:14.0pt; | ||
+ | font-family:等线'>,可之后设置:</span></p> | ||
+ | |||
+ | <p class=MsoNormal style='margin-left:.5in'><span class=SpellE><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman"; | ||
+ | color:#0080FF'>WeCompassSensor</span></b></span><b><span style='font-size:16.0pt; | ||
+ | font-family:"Courier New";color:#0080FF'> compass;</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>之后调用:</span><span | ||
+ | class=SpellE><span class=GramE><b><span style='font-size:16.0pt;font-family: | ||
+ | "Courier New";color:#0080FF'>compass.reset</span></b></span></span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>(PORT_B);</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal> </p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(2)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#8000FF'> void</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><span | ||
+ | class=GramE><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | color:#0080FF'>reset</span></b><b><span style='font-size:16.0pt;font-family: | ||
+ | "Courier New";color:black'>(</span></b></span><b><span style='font-size:16.0pt; | ||
+ | font-family:"Courier New";color:#8000FF'>uint8_t</span></b><span | ||
+ | style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:#0080FF'>port</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>=</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:red'>0</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";color:black'>)</span></b></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:可重新设置接口</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:</span></p> | ||
+ | |||
+ | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
+ | style='border-collapse:collapse;mso-yfti-tbllook:1184;mso-padding-alt:0in 0in 0in 0in'> | ||
+ | <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes; | ||
+ | height:25.6pt'> | ||
+ | <td style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | ||
+ | height:25.6pt'> | ||
+ | <p class=MsoNormal><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | color:#0080FF'>port</span></b></p> | ||
+ | </td> | ||
+ | <td width=330 style='width:247.4pt;border:solid windowtext 1.0pt;border-left: | ||
+ | none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | ||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | ||
+ | color:windowtext'>选择端口,如</span><span style='font-size:14.0pt;color:windowtext'>PORT_A,PORT_1</span><span | ||
+ | lang=ZH-CN style='font-size:14.0pt;font-family:等线;color:windowtext'>等</span></p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:无</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span style='font-size:10.0pt;font-family:等线'> </span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><b><span | ||
+ | style='font-size:12.0pt;font-family:"News Gothic MT",sans-serif'>(3)</span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New"'> </span></b><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman"; | ||
+ | color:#8000FF'>uint16_t</span></b><span style='font-size:10.0pt;font-family: | ||
+ | "Courier New";mso-fareast-font-family:"Times New Roman";color:black'> </span><span | ||
+ | class=SpellE><span class=GramE><b><span style='font-size:16.0pt;font-family: | ||
+ | "Courier New";mso-fareast-font-family:"Times New Roman";color:#0080FF'>readValue</span></b></span></span><span | ||
+ | class=GramE><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | mso-fareast-font-family:"Times New Roman";color:black'>(</span></b></span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman"; | ||
+ | color:#8000FF'>uint8_t</span></b><span style='font-size:10.0pt;font-family: | ||
+ | "Courier New";mso-fareast-font-family:"Times New Roman";color:black'> </span><b><span | ||
+ | style='font-size:16.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman"; | ||
+ | color:#0080FF'>index</span></b><b><span style='font-size:16.0pt;font-family: | ||
+ | "Courier New";mso-fareast-font-family:"Times New Roman";color:black'>)</span></b><span | ||
+ | style='font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-font-family: | ||
+ | "Times New Roman"'><o:p></o:p></span></p> | ||
+ | |||
+ | <p class=MsoNormal align=left style='text-align:left;background:white'><span | ||
+ | lang=ZH-CN style='font-size:14.0pt;font-family:等线'>描述:获取定向数据</span></p> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>参数:</span></p> | ||
+ | |||
+ | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
+ | style='border-collapse:collapse;mso-yfti-tbllook:1184;mso-padding-alt:0in 0in 0in 0in'> | ||
+ | <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes; | ||
+ | height:25.6pt'> | ||
+ | <td style='border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt; | ||
+ | height:25.6pt'> | ||
+ | <p class=MsoNormal><b><span style='font-size:16.0pt;font-family:"Courier New"; | ||
+ | mso-fareast-font-family:"Times New Roman";color:#0080FF'>index</span></b></p> | ||
+ | </td> | ||
+ | <td width=593 style='width:444.8pt;border:solid windowtext 1.0pt;border-left: | ||
+ | none;padding:0in 5.4pt 0in 5.4pt;height:25.6pt'> | ||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线; | ||
+ | color:windowtext'>选择获取某一方向轴上的定向角度,</span><span style='font-size:14.0pt; | ||
+ | font-family:等线;color:windowtext'>0<span lang=ZH-CN>为</span>X<span lang=ZH-CN>轴,</span>1<span | ||
+ | lang=ZH-CN>为</span>Y<span lang=ZH-CN>轴,</span>2<span lang=ZH-CN>为</span>Z<span | ||
+ | lang=ZH-CN>轴</span></span></p> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | <p class=MsoNormal><span lang=ZH-CN style='font-size:14.0pt;font-family:等线'>返回值:整数,</span><span | ||
+ | style='font-size:14.0pt;font-family:等线'>0~360</span></p> | ||
+ | |||
+ | <p class=MsoNormal> <span lang=ZH-CN style='font-size:14.0pt;font-family: | ||
+ | 等线'>编程示例:</span> </p> | ||
+ | </body></html> | ||
+ | |||
+ | <sxh c/c++; first-line: 1;highlight: [50,100]; title: compass_test.ino> | ||
+ | #include "WeELF328P.h" | ||
+ | | ||
+ | WeCompassSensor compass(PORT_A); | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | Serial.begin(115200); | ||
+ | } | ||
+ | void loop() | ||
+ | { | ||
+ | int16_t head_X; | ||
+ | compass.update(); | ||
+ | head_X = compass.readValue(0); | ||
+ | Serial.print("Compass:"); | ||
+ | Serial.println(head_X); | ||
+ | delay(200); | ||
+ | } | ||
+ | |||
+ | </sxh> | ||
+ | \\ |