First, my apologies if this is a repeated topic or question, but I can't seem to find a straight forward example of what I'm trying to do, which is this:
I'm working on a controller that will speak to a motor drive via bluetooth. I'm using the pro mini, and the gold sparkfun bluetooth. The information I need to stream includes the two analog reads from the joystick, two button states, and an analog read from an accelerometer (this is so the drive can determine if the device is being held in someones hand, or if is on the floor; a safety).
Does anyone have a lead on where I might have a look at some code that transmits from the arduino over bluetooth? I've seen many posts on communicating with an Android, which I am not doing. The rest seem to be all about receiving data.
Any help is greatly appreciated!
Have a look at the examples in Serial Input Basics - especially the 3rd example and the parse example.
These techniques are just as valid for receiving data on a PC or an Android device - obviously they would need to be written in the language you are using on the PC or Android.
I mirror @Nick_Pyner thoughts…
What you have explained doesnt really make much sense… it seems an aspect is missing.
Lets re-cap the basics…
- You have an Arduino that has some sensors connected to it.
- you have a bluetooth module
Seems you are either missing the ‘sender’ or the ‘receiver’??
What is your ‘remote’? (the device that is sending the data?)… is this the Arduino and BT module?
If so… then what is the receiver?
You need a BT endabled device to SEND data…
You need a BT enabled device to RECEIVE data…
As far as sending data… its doesnt matter.
You can set the format/protocol you want… because you will also need to receive and parse this data.
I would suggest using format that has SOP and an EOP (start of packet/end of packet) character.
sop = <
data val 1: 100
data val 2: 0
data val 3: 240
eop = >
concatenate them into one ‘variable’ to send out via serial/bluetooh
In your receiving code… you can them parse and break up the data…
you know that data val 1 is (whatever… analog 1 etc) and the order… so parse it as such