https://wiki.microduinoinc.com/index.php?title=Bluetooth_Light&feed=atom&action=history
Bluetooth Light - Revision history
2024-03-29T05:33:51Z
Revision history for this page on the wiki
MediaWiki 1.28.2
https://wiki.microduinoinc.com/index.php?title=Bluetooth_Light&diff=12897&oldid=prev
Fengfeng at 06:55, 30 September 2016
2016-09-30T06:55:07Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 06:55, 30 September 2016</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l31" >Line 31:</td>
<td colspan="2" class="diff-lineno">Line 31:</td></tr>
<tr><td class='diff-marker'> </td><td style="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;"></td><td class='diff-marker'> </td><td style="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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>==Preparation==</div></td><td class='diff-marker'> </td><td style="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;"><div>==Preparation==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*Setup <del class="diffchange diffchange-inline">1:Use </del>a USB cable to connect the CoreUSB and the PC/Mac, the open Arduino IDE.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>*Setup <ins class="diffchange diffchange-inline">1: Use </ins>a USB cable to connect the CoreUSB and the PC/Mac, the open Arduino IDE.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>  [[Image:CoreUSB_Ble_pc.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>  [[Image:CoreUSB_Ble_pc.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*Setup <del class="diffchange diffchange-inline">2:</del></div></td><td class='diff-marker'>+</td><td style="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;"><div>*Setup <ins class="diffchange diffchange-inline">2:</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>Click Files > Examples > mCookie > _103_BLE_Light, and load the program. Or download:</div></td><td class='diff-marker'> </td><td style="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;"><div>Click Files > Examples > mCookie > _103_BLE_Light, and load the program. Or download:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:_103_BLE_Light.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:_103_BLE_Light.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>* Setup <del class="diffchange diffchange-inline">3:Select </del>the right board and COM port for program download.</div></td><td class='diff-marker'>+</td><td style="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;"><div>* Setup <ins class="diffchange diffchange-inline">3: Select </ins>the right board and COM port for program download.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>==Program Description==</div></td><td class='diff-marker'> </td><td style="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;"><div>==Program Description==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>*Here the Bluetooth adopts serial communication. For mCookie-CoreUSB, it uses '''Serial1'''. So we define serial port service.  </div></td><td class='diff-marker'> </td><td style="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;"><div>*Here the Bluetooth adopts serial communication. For mCookie-CoreUSB, it uses '''Serial1'''. So we define serial port service.  </div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l59" >Line 59:</td>
<td colspan="2" class="diff-lineno">Line 59:</td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, A0, NEO_GRB + NEO_KHZ800);</div></td><td class='diff-marker'> </td><td style="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;"><div>Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, A0, NEO_GRB + NEO_KHZ800);</div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div></source></div></td><td class='diff-marker'> </td><td style="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;"><div></source></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*<del class="diffchange diffchange-inline">“ble</del>()<del class="diffchange diffchange-inline">”function </del>is used to receive and analyze data sent from the phone:  </div></td><td class='diff-marker'>+</td><td style="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;"><div>*<ins class="diffchange diffchange-inline">"ble</ins>()<ins class="diffchange diffchange-inline">" function </ins>is used to receive and analyze data sent from the phone:  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div><source lang="cpp"></div></td><td class='diff-marker'> </td><td style="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;"><div><source lang="cpp"></div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>sscanf((char *)strstr((char *)buffer, "C:"), "C:%d,%d,%d,%d", &sta[0], &sta[1], &sta[2], &sta[3]);</div></td><td class='diff-marker'> </td><td style="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;"><div>sscanf((char *)strstr((char *)buffer, "C:"), "C:%d,%d,%d,%d", &sta[0], &sta[1], &sta[2], &sta[3]);</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l90" >Line 90:</td>
<td colspan="2" class="diff-lineno">Line 90:</td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>   }</div></td><td class='diff-marker'> </td><td style="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;"><div>   }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div></source></div></td><td class='diff-marker'> </td><td style="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;"><div></source></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*<del class="diffchange diffchange-inline">“rainbowCycle</del>(w, R, G, B, x);<del class="diffchange diffchange-inline">”Function </del>Using Description: Users can change the color as you like.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>*<ins class="diffchange diffchange-inline">"rainbowCycle</ins>(w, R, G, B, x);<ins class="diffchange diffchange-inline">" Function </ins>Using Description: Users can change the color as you like.  </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>**<del class="diffchange diffchange-inline">w:Delay </del>time of the color gradual change.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>**<ins class="diffchange diffchange-inline">w: Delay </ins>time of the color gradual change.  </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>**<del class="diffchange diffchange-inline">R,G,B </del>: Three primary colors.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>**<ins class="diffchange diffchange-inline">R, G, B </ins>: Three primary colors.  </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>**<del class="diffchange diffchange-inline">x:“0” </del>indicates the brightness changes from weak to strong; "1" indicates the brightness changes from strong to weak.   </div></td><td class='diff-marker'>+</td><td style="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;"><div>**<ins class="diffchange diffchange-inline">x: "0" </ins>indicates the brightness changes from weak to strong; "1" indicates the brightness changes from strong to weak.   </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"></td><td class='diff-marker'> </td><td style="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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>==Hardware Buildup==</div></td><td class='diff-marker'> </td><td style="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;"><div>==Hardware Buildup==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*Setup <del class="diffchange diffchange-inline">1:Since </del>the program code control adopts A0, you can connect the LED light to the Hub's A0 interface. Users can also customize the interface here.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>*Setup <ins class="diffchange diffchange-inline">1: Since </ins>the program code control adopts A0, you can connect the LED light to the Hub's A0 interface. Users can also customize the interface here.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:CoreUSB_Ble_steup1.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:CoreUSB_Ble_steup1.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>The connection method of the LED light can refer to the picture below. Please be noted of the connection order, which connect from LED's IN interface to OUT.   </div></td><td class='diff-marker'> </td><td style="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;"><div>The connection method of the LED light can refer to the picture below. Please be noted of the connection order, which connect from LED's IN interface to OUT.   </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:CoreUSB_Ble_steup11.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:CoreUSB_Ble_steup11.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*Setup <del class="diffchange diffchange-inline">2:Connect </del>the activated battery box and the BM module.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>*Setup <ins class="diffchange diffchange-inline">2: Connect </ins>the activated battery box and the BM module.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:CoreUSB_Ble_steup2.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:CoreUSB_Ble_steup2.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*Setup <del class="diffchange diffchange-inline">3:Then</del>, stack all modules together without considering order. Congratulations! You've finished the circuit buildup.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>*Setup <ins class="diffchange diffchange-inline">3: Then</ins>, stack all modules together without considering order. Congratulations! You've finished the circuit buildup.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:CoreUSB_Ble_steup3.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:CoreUSB_Ble_steup3.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"></td><td class='diff-marker'> </td><td style="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;"></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>==APP Debugging==</div></td><td class='diff-marker'> </td><td style="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;"><div>==APP Debugging==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*Setup <del class="diffchange diffchange-inline">1:Scan </del>the two-dimensional code on the left and download Bluetooth Light App.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>*Setup <ins class="diffchange diffchange-inline">1: Scan </ins>the two-dimensional code on the left and download Bluetooth Light App.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup1.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup1.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>ios Source download link:[https://github.com/zidong0822/MLight2 LightBlue App]</div></td><td class='diff-marker'> </td><td style="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;"><div>ios Source download link:[https://github.com/zidong0822/MLight2 LightBlue App]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*Setup <del class="diffchange diffchange-inline">2:Open </del>the App after the download and installation. If the Bluetooth is disconnected, the system will pop up a notice.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>*Setup <ins class="diffchange diffchange-inline">2: Open </ins>the App after the download and installation. If the Bluetooth is disconnected, the system will pop up a notice.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup2.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup2.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*Setup <del class="diffchange diffchange-inline">3:Click </del>Scan and the phone will start searching Bluetooth devices and display them below; Select the Microduino device.   </div></td><td class='diff-marker'>+</td><td style="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;"><div>*Setup <ins class="diffchange diffchange-inline">3: Click </ins>Scan and the phone will start searching Bluetooth devices and display them below; Select the Microduino device.   </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup3.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup3.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="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;"><div>*Setup <del class="diffchange diffchange-inline">4:After </del>the connection, you can use your phone to control LED lights.  </div></td><td class='diff-marker'>+</td><td style="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;"><div>*Setup <ins class="diffchange diffchange-inline">4: After </ins>the connection, you can use your phone to control LED lights.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup4.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup4.jpg|600px|center]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"></td><td class='diff-marker'> </td><td style="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;"></td></tr>
</table>
Fengfeng
https://wiki.microduinoinc.com/index.php?title=Bluetooth_Light&diff=12896&oldid=prev
Yanglibin@microduino.cc: /* APP Debugging */
2015-12-17T09:24:34Z
<p><span dir="auto"><span class="autocomment">APP Debugging</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 09:24, 17 December 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l108" >Line 108:</td>
<td colspan="2" class="diff-lineno">Line 108:</td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>*Setup 1:Scan the two-dimensional code on the left and download Bluetooth Light App.  </div></td><td class='diff-marker'> </td><td style="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;"><div>*Setup 1:Scan the two-dimensional code on the left and download Bluetooth Light App.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup1.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup1.jpg|600px|center]]</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="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;"><div><ins style="font-weight: bold; text-decoration: none;">ios Source download link:[https://github.com/zidong0822/MLight2 LightBlue App]</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>*Setup 2:Open the App after the download and installation. If the Bluetooth is disconnected, the system will pop up a notice.  </div></td><td class='diff-marker'> </td><td style="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;"><div>*Setup 2:Open the App after the download and installation. If the Bluetooth is disconnected, the system will pop up a notice.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup2.jpg|600px|center]]</div></td><td class='diff-marker'> </td><td style="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;"><div>[[File:app_Ble_steup2.jpg|600px|center]]</div></td></tr>
</table>
Yanglibin@microduino.cc
https://wiki.microduinoinc.com/index.php?title=Bluetooth_Light&diff=12895&oldid=prev
1304410487@qq.com: Created page with "{{Language| Bluetooth Light}} {| style="width: 800px;" |- | ==Overview== Here we can control the color and brightness of a light by App Android. When the phone is not connecte..."
2015-11-06T08:31:58Z
<p>Created page with "{{Language| Bluetooth Light}} {| style="width: 800px;" |- | ==Overview== Here we can control the color and brightness of a light by App Android. When the phone is not connecte..."</p>
<p><b>New page</b></p><div>{{Language| Bluetooth Light}}<br />
{| style="width: 800px;"<br />
|-<br />
|<br />
==Overview==<br />
Here we can control the color and brightness of a light by App Android. When the phone is not connected to the Bluetooth, the light can automatically change color. While after the phone is connected, you can change the light to any color through the phone.<br />
[[File:bluetooth-light.jpg|600px|center]]<br />
<br />
==Principle== <br />
The system can tell whether the mobile phone Bluetooth and mCookie-BT are connected or not. When connected, the system receives the data from the App to the mobile phone mCookie-BT, and analysis it out so as to control the color of the lamp. When the Bluetooth is disconnected, the system enters the pre-set color changing mode. Unless there is a Bluetooth connection, otherwise it'll enter the cycle mode.<br />
<br />
<br />
[[File:bluetooth-light-sch.jpg|center|600px]]<br />
<br />
==Equipment==<br />
{|class="wikitable"<br />
|-<br />
|Module||Number||Function<br />
|-<br />
|[[Microduino-CoreUSB]]||1||Core board <br />
|-<br />
|[[Microduino-Sensorhub]]||1||Sensor pinboard <br />
|-<br />
|[[Microduino-BT]]||1||Bluetooth module <br />
|-<br />
| [[Microduino-Color LED]]||1||colored light<br />
|-<br />
| [[Microduino-BM]]||1||Battery management <br />
|}<br />
[[File:ble_lamp.jpg|600px|center|thumb]]<br />
<br />
==Preparation==<br />
*Setup 1:Use a USB cable to connect the CoreUSB and the PC/Mac, the open Arduino IDE. <br />
[[Image:CoreUSB_Ble_pc.jpg|600px|center]]<br />
*Setup 2:<br />
Click Files > Examples > mCookie > _103_BLE_Light, and load the program. Or download:<br />
[[File:_103_BLE_Light.jpg|600px|center]]<br />
* Setup 3:Select the right board and COM port for program download.<br />
==Program Description==<br />
*Here the Bluetooth adopts serial communication. For mCookie-CoreUSB, it uses '''Serial1'''. So we define serial port service. <br />
<source lang="cpp"><br />
#define my_Serial Serial1<br />
</source><br />
*At the same time, the baud rate of the Bluetooth communication is 9,600. You need to define serial communication rate in '''setup()'''.<br />
<source lang="cpp"><br />
my_Serial.begin(9600);<br />
</source><br />
*Colored LED Control Description <br />
<source lang="cpp"><br />
#define PIXEL_PIN A0 // Digital IO pin connected to the NeoPixels.<br />
#define PIXEL_COUNT 6<br />
<br />
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);<br />
</source><br />
**'''PIXEL_PIN''': The colored LED's control pin. Users can customize the pin according to personal needs but need to change hardware connection at the same time. <br />
**'''PIXEL_COUNT''': The number of the LED light. One Bluetooth can only control six lights due to the APP Bluetooth transmission data write six at most. <br />
*“#define xxx yy”function: Give the value of " yy " to " xxx ". You can change the function above to: <br />
<source lang="cpp"><br />
Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, A0, NEO_GRB + NEO_KHZ800);<br />
</source><br />
*“ble()”function is used to receive and analyze data sent from the phone: <br />
<source lang="cpp"><br />
sscanf((char *)strstr((char *)buffer, "C:"), "C:%d,%d,%d,%d", &sta[0], &sta[1], &sta[2], &sta[3]);<br />
</source><br />
Transmission protocol analyzed from the code: " C:%d,%d,%d,%d " and assign value of the four analyzed data "%d " to sta[0], sta[1], sta[2] and sta[3], three of which are the color values of the R, G and B. The last value is the control mode selection. <br />
*Use the analyzed data to control light color change. <br />
<source lang="cpp"><br />
if (-1 == sta[3]) {<br />
colorSet(strip.Color(sta[0], sta[1], sta[2]));<br />
}<br />
else if ((0 <= sta[3]) && (sta[3] < PIXEL_COUNT)) {<br />
colorSet(strip.Color(sta[0], sta[1], sta[2]), sta[3]);<br />
}<br />
</source><br />
If the value of sta[3] is -1, then all lights connected display the same color. That color is combined by " sta[0], sta[1], sta[2]",namely, the color selected on the phone. Otherwise, these six lights can also be controlled separately. <br />
*When there is Bluetooth connection, it will keep sending "\n " data to BT. As long as there is receiving, we can consider the Bluetooth is in connection. In this case, the value of " color_en " is true. <br />
<source lang="cpp"><br />
if (c == '\n')<br />
{<br />
color_en = true;<br />
safe_ms = millis();<br />
}<br />
</source><br />
*When the Bluetooth is disconnected, the system will make the value of " color_en " false in three seconds, starting to perform custom color change. "!" means "not". <br />
<source lang="cpp"><br />
if (millis() - safe_ms > 3000)//Users can change the time. The unit of "3,000" is "ms". <br />
{<br />
safe_ms = millis();<br />
color_en = false;<br />
}<br />
</source><br />
*“rainbowCycle(w, R, G, B, x);”Function Using Description: Users can change the color as you like. <br />
**w:Delay time of the color gradual change. <br />
**R,G,B : Three primary colors. <br />
**x:“0” indicates the brightness changes from weak to strong; "1" indicates the brightness changes from strong to weak. <br />
<br />
==Hardware Buildup==<br />
*Setup 1:Since the program code control adopts A0, you can connect the LED light to the Hub's A0 interface. Users can also customize the interface here. <br />
[[File:CoreUSB_Ble_steup1.jpg|600px|center]]<br />
The connection method of the LED light can refer to the picture below. Please be noted of the connection order, which connect from LED's IN interface to OUT. <br />
[[File:CoreUSB_Ble_steup11.jpg|600px|center]]<br />
*Setup 2:Connect the activated battery box and the BM module. <br />
[[File:CoreUSB_Ble_steup2.jpg|600px|center]]<br />
*Setup 3:Then, stack all modules together without considering order. Congratulations! You've finished the circuit buildup. <br />
[[File:CoreUSB_Ble_steup3.jpg|600px|center]]<br />
<br />
==APP Debugging==<br />
*Setup 1:Scan the two-dimensional code on the left and download Bluetooth Light App. <br />
[[File:app_Ble_steup1.jpg|600px|center]]<br />
*Setup 2:Open the App after the download and installation. If the Bluetooth is disconnected, the system will pop up a notice. <br />
[[File:app_Ble_steup2.jpg|600px|center]]<br />
*Setup 3:Click Scan and the phone will start searching Bluetooth devices and display them below; Select the Microduino device. <br />
[[File:app_Ble_steup3.jpg|600px|center]]<br />
*Setup 4:After the connection, you can use your phone to control LED lights. <br />
[[File:app_Ble_steup4.jpg|600px|center]]<br />
<br />
==Video==<br />
<br />
|}</div>
1304410487@qq.com