<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=BLE%E6%A8%A1%E5%9D%97%E4%B8%8E%E6%89%8B%E6%9C%BAAPP_mRobots%E9%80%9A%E4%BF%A1%E7%A4%BA%E4%BE%8B</id>
		<title>BLE模块与手机APP mRobots通信示例 - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=BLE%E6%A8%A1%E5%9D%97%E4%B8%8E%E6%89%8B%E6%9C%BAAPP_mRobots%E9%80%9A%E4%BF%A1%E7%A4%BA%E4%BE%8B"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=BLE%E6%A8%A1%E5%9D%97%E4%B8%8E%E6%89%8B%E6%9C%BAAPP_mRobots%E9%80%9A%E4%BF%A1%E7%A4%BA%E4%BE%8B&amp;action=history"/>
		<updated>2026-06-04T18:48:52Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=BLE%E6%A8%A1%E5%9D%97%E4%B8%8E%E6%89%8B%E6%9C%BAAPP_mRobots%E9%80%9A%E4%BF%A1%E7%A4%BA%E4%BE%8B&amp;diff=22465&amp;oldid=prev</id>
		<title>2017年9月13日 (三) 11:57 1196357542</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=BLE%E6%A8%A1%E5%9D%97%E4%B8%8E%E6%89%8B%E6%9C%BAAPP_mRobots%E9%80%9A%E4%BF%A1%E7%A4%BA%E4%BE%8B&amp;diff=22465&amp;oldid=prev"/>
				<updated>2017-09-13T11:57:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;zh-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2017年9月13日 (三) 11:57的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l12&quot; &gt;第12行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第12行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[[MCookie-BLE]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[[MCookie-BLE]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[[MCookie-Motor/zh]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[[MCookie-Motor/zh]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;N20电机*2&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;N20电机*2&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;小车轮*2&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;小车轮*2&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot; &gt;第21行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第21行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;p style=&amp;quot;color: #E87E05;font-size:135%&amp;quot;&amp;gt;电路搭建&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;p style=&amp;quot;color: #E87E05;font-size:135%&amp;quot;&amp;gt;电路搭建&amp;lt;/p&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;将Battery、Core、、、堆叠在一起，通过MicroUSB数据线接入电脑。初次使用请参考：&lt;/del&gt;[[AVR核心：Getting_started/zh|Getting Started]]。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;将Battery、Core、BLE、Motor堆叠在一起，通过MicroUSB数据线接入电脑。初次使用请参考：&lt;/ins&gt;[[AVR核心：Getting_started/zh|Getting Started]]。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:.jpg|600px|center]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:.jpg|600px|center]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>1196357542</name></author>	</entry>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=BLE%E6%A8%A1%E5%9D%97%E4%B8%8E%E6%89%8B%E6%9C%BAAPP_mRobots%E9%80%9A%E4%BF%A1%E7%A4%BA%E4%BE%8B&amp;diff=22464&amp;oldid=prev</id>
		<title>1196357542：创建页面，内容为“{| style=&quot;width: 800px;&quot; |- | &lt;p style=&quot;color: #4F4E4E;font-size:220%&quot;&gt;'''BLE模块与手机APP mRobots通信示例'''&lt;/p&gt; &lt;br&gt; 此示例给出了BLE模块与手机A...”</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=BLE%E6%A8%A1%E5%9D%97%E4%B8%8E%E6%89%8B%E6%9C%BAAPP_mRobots%E9%80%9A%E4%BF%A1%E7%A4%BA%E4%BE%8B&amp;diff=22464&amp;oldid=prev"/>
				<updated>2017-09-13T11:57:09Z</updated>
		
		<summary type="html">&lt;p&gt;创建页面，内容为“{| style=&amp;quot;width: 800px;&amp;quot; |- | &amp;lt;p style=&amp;quot;color: #4F4E4E;font-size:220%&amp;quot;&amp;gt;&amp;#039;&amp;#039;&amp;#039;BLE模块与手机APP mRobots通信示例&amp;#039;&amp;#039;&amp;#039;&amp;lt;/p&amp;gt; &amp;lt;br&amp;gt; 此示例给出了BLE模块与手机A...”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;p style=&amp;quot;color: #4F4E4E;font-size:220%&amp;quot;&amp;gt;'''BLE模块与手机APP mRobots通信示例'''&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
此示例给出了BLE模块与手机APP mRobots通信的方法，可以用APP mRobots来控制小车的运动。&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p style=&amp;quot;color: #E87E05;font-size:135%&amp;quot;&amp;gt;所需硬件&amp;lt;/p&amp;gt;&lt;br /&gt;
*[[mCookie-Core]]&lt;br /&gt;
*[[mCookie-Battery]]&lt;br /&gt;
*[[MCookie-BLE]]&lt;br /&gt;
*[[MCookie-Motor/zh]]&lt;br /&gt;
N20电机*2&lt;br /&gt;
小车轮*2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:.jpg|600px|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p style=&amp;quot;color: #E87E05;font-size:135%&amp;quot;&amp;gt;电路搭建&amp;lt;/p&amp;gt;&lt;br /&gt;
将Battery、Core、、、堆叠在一起，通过MicroUSB数据线接入电脑。初次使用请参考：[[AVR核心：Getting_started/zh|Getting Started]]。&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:.jpg|600px|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p style=&amp;quot;color: #E87E05;font-size:135%&amp;quot;&amp;gt;代码&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Microduino_Protocol.h&amp;gt;&lt;br /&gt;
#include &amp;lt;Microduino_Motor.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define _DEBUG  //DEBUG调试&lt;br /&gt;
&lt;br /&gt;
#define BLE_SPEED 9600  //蓝牙接口速度&lt;br /&gt;
#define CHANNEL_NUM   8&lt;br /&gt;
#define SAFE_TIME_OUT 250   //失控保护时间&lt;br /&gt;
#define MAX_THROTTLE 255 //最大油门 &amp;lt; 255&lt;br /&gt;
#define MAX_STEERING 512 //最大转向 &amp;lt; 512&lt;br /&gt;
#define CHANNEL_THROTTLE  1 //油门通道&lt;br /&gt;
#define CHANNEL_STEERING  0 //转向通道&lt;br /&gt;
&lt;br /&gt;
Motor MotorLeft(MOTOR0_PINA, MOTOR0_PINB);&lt;br /&gt;
Motor MotorRight(MOTOR1_PINA, MOTOR1_PINB);&lt;br /&gt;
&lt;br /&gt;
#define ProSerial Serial&lt;br /&gt;
ProtocolSer bleProtocol(&amp;amp;ProSerial, 16);  //采用ProSerial，数据长度为16个字节&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////&lt;br /&gt;
uint16_t channalData[CHANNEL_NUM]; //8通道数据&lt;br /&gt;
int16_t throttle = 0; //油门&lt;br /&gt;
int16_t steering = 0; //转向&lt;br /&gt;
unsigned long safe_ms = millis();&lt;br /&gt;
&lt;br /&gt;
uint8_t recCmd;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  Serial.println(&amp;quot;Hello Microduino!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  bleProtocol.begin(BLE_SPEED);&lt;br /&gt;
&lt;br /&gt;
  MotorLeft.begin();   //电机MotorLeft初始化&lt;br /&gt;
  MotorRight.begin();  //电机MotorLeft初始化&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
  if (bleProtocol.available())&lt;br /&gt;
  {&lt;br /&gt;
    bleProtocol.readWords(&amp;amp;recCmd, channalData, 8);&lt;br /&gt;
&lt;br /&gt;
    throttle = map(channalData[CHANNEL_THROTTLE], 1000, 2000, -MAX_THROTTLE, MAX_THROTTLE);&lt;br /&gt;
    steering = map(channalData[CHANNEL_STEERING], 1000, 2000, -MAX_STEERING, MAX_STEERING);&lt;br /&gt;
&lt;br /&gt;
    MotorLeft.setSpeed((throttle + steering / 2));&lt;br /&gt;
    MotorRight.setSpeed(-(throttle - steering / 2));&lt;br /&gt;
&lt;br /&gt;
#ifdef _DEBUG&lt;br /&gt;
    Serial.print(&amp;quot;DATA OK :[&amp;quot;);&lt;br /&gt;
    for (int a = 0; a &amp;lt; CHANNEL_NUM; a++) {&lt;br /&gt;
      Serial.print(channalData[a]);&lt;br /&gt;
      Serial.print(&amp;quot; &amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    Serial.print(&amp;quot;],throttle:&amp;quot;);&lt;br /&gt;
    Serial.print(throttle);&lt;br /&gt;
    Serial.print(&amp;quot;,steering:&amp;quot;);&lt;br /&gt;
    Serial.println(steering);&lt;br /&gt;
#endif&lt;br /&gt;
    safe_ms = millis();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  if (safe_ms &amp;gt; millis()) safe_ms = millis();&lt;br /&gt;
  if (millis() - safe_ms &amp;gt; SAFE_TIME_OUT) {&lt;br /&gt;
    MotorLeft.setSpeed(FREE);  //设置电机MotorLeft为释放状态，即速度为0&lt;br /&gt;
    MotorRight.setSpeed(FREE);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p style=&amp;quot;color: #E87E05;font-size:135%&amp;quot;&amp;gt;相关案例&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p style=&amp;quot;font-size:115%&amp;quot;&amp;gt;[[Protocol_Reference|返回Protocol_Reference界面]]&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>1196357542</name></author>	</entry>

	</feed>