As my first instructable, I'd like to show how to connect to an arduino for I/O from an android device quickly and easily.
For the following steps we'll need:
You can download the library I'm going to use here:
Download the BlueDentist arduino library and unzip it. You will have a folder that you can copy into your arduino/libraries directory. It if arduino IDE is open, restart it now. BlueDentist should show up for you to import into your sketches now.
Next you will need the app to connect to the arduino using the library you just installed. I put the free version of the app for this tutorial on the google Play Store:
In the free version your interface is limited to 3 widgets, if you decide you want the full version it's also on the play store: ToothFairy
Make a new arduino sketch. I have a "Hello World" sketch I created for this instructable. If you want to just download the file it is at instructable.ino.
#include
BlueDentist *myDent; BDLogField *myLog; BDBTN *myBtn;
void setup() {
myDent = new BlueDentist(9600); //9600 Baud, default for HC-05 change if your module is a different baud rate
myLog = new BDLogField("log");//name is log, but this can be anything. Remember widget names must be unique,
//and should be as short as possible. For more details on that read the documentation at avrthing.com/toothfairy
myBtn = new BDBTN("Hello");
myDent->add(myLog);
myDent->add(myBtn);
}
void loop() {
if(myBtn->getPresses())
{
myBtn->reset();
myLog->println("hello world");
}
myDent->run();
}
Depending on your device you may have to disconnect the HC-05 module to upload correctly. Mine worked fine with it still connected, but if you do disconnect it the easiest way is to pull the whole module out of the breadboard, and leave the wires in place.
In Settings->Bluetooth you should see a list of available devices. As long as your HC-05 module is powered, it will show up as HC-05. I changed the name of my module using the AT commands, so my module is showing up as "FREEZERTRON". Select your module to pair the device. It will ask you for a PIN, the default for the HC-05 is 1234.