![]() If you want to play further with the code, read the following tips first: - Read the User Manual (I included a copy) - Serial speed: By default, BlueSmirf is set to 115200 so you need to call Serial.begin(115200) before sending the first command. Here is an example where 2 addresses are added: gBtKnownMAC = "000666412345" gBtKnownMAC = "000666454321" Upload this code to both modules and move to the next step. Then go in the BtInit() function and add your addresses into the gBtKnownMAC list. To do that set the length of the gBtKnownMAC variable to the total number of devices you want to scan. IMPORTANT: You must edit the code to add you BlueTooth devices MAC addresses into the list of 'trusted' addresses. On/closed is the master while off/open is the slave. The code will execute as Master or Slave depending on the Jumper (or switch) state. The included code (bt2bt.zip) is for both Master & Slave modules. Connect the other side (B) to 5v using a 10k Ohm resistor. The Switch/Jumper Connect one side (A) of the Jumper to GND. If they don't light up in that sequence, fix it by switching theme around. To be on the safe side, the program will cycle the three colors (Blue, Red and then Green) at start-up. The documentation is not always right (voice of experience). Note: Make sure you know the function of each pins of your LED. ![]() Connect the LED GND pin to the Arduino GND. Connect the Red, Green and Blue LED pins to the Arduino Pin 5, 6 and 7 (in that order). The RGB LED Use 560 Ohm resistors to connect the LED to the Arduino pins. This way we can directly use the Arduino Serial commands. Note: The simplest way to connect the BlueSmirf breakout board is to connect it directly to the RX (Pin0) and TX (Pin1) of the Arduino. Finishi by connecting the bluetooth GND to the Arduino GND and the bluetooth VCC to the Arduino 5V. The BlueTooth board Connect the the bluetooth rx to the Arduino tx and the bluetooth tx to the Arduino rx. ![]() The following instructions are all making reference to the image model. Optional feature: - Data logging: You can add Micro-SD data logging to the Master and/or the Slave module ![]() Master-Slave Jumper: You can quickly set a module type (master or slave) by using a single jumper. Info Light: The RGB LED will help visualize the states of the modules and the connection. Features: - Auto-Detect: The Master module will scan, discover and connect to the first Slave Module. I also wanted the Master device to scan for other devices, retrieve the MAC address, connect and send data. I wanted to heave the same code on both Arduinos and have the whole connection process be automatic. To make things interesting, I've set a couple of rules for the project. Using a second Bluetooth board, I decided to create a link between two autonomous Arduinos. The next logical step was to use the BlueSmirf interface by programming the Arduino. II used the BlueSmirf BlueTooth breakout board in default (slave) mode by connecting with it using an Android phone. This will sow a way to auto-detect and create a link Using BlueTooth, this is a way for a 'master' module to detect a 'slave' module using Arduino and BlueSmirf BlueTooth. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |