Programming with Bluetooth Module


I’ve been working on my first “big” project with the Arduino, constructing an RC car controlled via iPhone. Thus far, I’ve managed to control the servo (steering) and two dc motors (forward/reverse). However, as I begin to tie everything together, I’m having some difficulty understanding how to successfully control anything via Bluetooth. I’ve studied some forums and videos and began taking a small step toward controlling the servo. The Bluetooth module I’m using is a “DSD TECH HM-10 Bluetooth 4.0 BLE iBeacon UART Module with 4PIN Base Board for Arduino UNO R3 Mega 2560 Nano.” Furthermore, the IOS app that I am using as a controller is “BLEJoyStick.” The app connects to the app via Bluetooth without an issue, but nothing happens when an input is given to control the servo. Obviously, there seems to be an issue with the code, and after several attempts at finding an answer, I’m clueless unto what to do and am beginning to feel defeated. I will admit I’m a novice, but I’ve taken the time to acquire somewhat of a sensible knowledge regarding programming on an Arduino to some extent. Below I’ve attached the programming file that I’ve done so far. Any help and/or critiques will be greatly appreciated as this is the last step towards finishing to project.

bluetooth_test.ino (377 Bytes)

How to you have this wired up? If you have the module RX/TX wired directly to Pin 0 and 1, you don't need to SoftwareSerial library. If you have it wired to other pins, then you will need that library and you will have to include some code in your sketch to define it.

It is easier to debug your program if you leave the hardware serial port (0/1) open and available for printing debug statements to the Serial Monitor and do the bluetooth communication on different pins with SoftwareSerial.