Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.

arduinoBT reading/sending data via serial communication
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

arduinoBT reading/sending data via serial communication

by tibay on Wed Apr 15, 2009 3:04 am

I'm currently working on a project in which a toy car is controlled by reading accelerometer info sent from a remote controlled car. The goal is to make the follower car mimic the movement of the lead remote controlled vehicle. To achieve this goal, I'm using the wireless Witilt to send accelerometer data via bluetooth serial connection to the arduino BT that should control the motors on the following vehicle.

Unfortunately, I've been having problems with the serial communication and can't proceed with my project.
According to the following link:, the witilt data gets sent as a series of 28:

// 88 61 45 48 46 51 56 49 32 89 61 32 49 46 48 52 50 32 90 61 45 48 46 56 48 52 10 13
// X = - 0 . 3 8 1 SP Y = SP 1 . 0 4 2 SP Z = - 0 . 8 0 4 \n \r
// SP : space
// \n : Line feed
// \r : Carriage return
// Every series is separated by a \r char meaning 13 in decimal. We localize it , then do an array of the 28
// next values and then parse 3 substring with my X, Y, and Z values.

To test this communication, I wrote up the following program to read the witilt input data and print the resulting array

Code: Select all | TOGGLE FULL SIZE
int seriescounter=0;
byte inbyte;
int seriesInArray[28];
int ax=0;                    //x_accel
int ay=0;                    //y_accel
int R=0;                     //deg/sec
int i;
boolean debut=false;

void setup() {

void loop(){
      Serial.println("receiving data");;
        Serial.println("store incoming byte");
    Serial.println(seriesInArray[i], BYTE);

After successfully testing the microcontroller with example programs like "Blink!" and servo and dc motor programs that control the output, I tried running this program to test the input into the microcontroller.

I have successfully compiled this program and uploaded it onto the arduinobt microcontroller. However, when I tried testing this code by sending text messages (x this is a test! this is a test!) through the arduino IDE serial monitor in the 'send' box. I do not receive any data.

So, I backtracked and tried testing the simple "Hello World!" test program in the tutorial:
Code: Select all | TOGGLE FULL SIZE
 * Hello World!
 * This is the Hello World! for Arduino.
 * It shows how to send data to the computer


void setup()                    // run once, when the sketch starts
  Serial.begin(9600);           // set up Serial library at 9600 bps

  Serial.println("Hello world!");  // prints hello with ending line break

void loop()                       // run over and over again

                                  // do nothing!

After successfully uploading the program, I switched over to the serial monitor and reset the board. The message appears! But after pressing the reset button again, it does not print to the serial monitor again, as should be the expected outcome according to the tutorial. Furthermore, when I move the Serial.println("Hello world!"); command to the void loop() section, upload the program, switch to the serial monitor and press the reset button, no messages print!

I'm a complete newb to this programming/robotics stuff, so I'd appreciate any help with this problem. :(
Posts: 1
Joined: Wed Apr 15, 2009 2:43 am

Please be positive and constructive with your questions and comments.