Go Down

Topic: JY-MCU v1.05 Bluetooth Module with Arduino Mega 1280 (Read 1 time) previous topic - next topic


Hi all,

I'm having trouble getting this Bluetooth module to work. Using Android's Amarino app, a connection with the module can be established, but the module doesn't receive any data sent to it from the app. The code I have been working with is as follows:

Code: [Select]
#include <MeetAndroid.h>

#include <SoftwareSerial.h>
#define SOP '<'
#define EOP '>'

bool started = false;
bool ended = false;

char inData[80];
byte index;

String readString;

int runOnce = 1;

SoftwareSerial mySerial(19, 18); // RX, TX

void setup() 

  // Open serial communications and wait for port to open:
  Serial.println("Correct baud rate selected [9600]. Connection established");
  // set the data rate for the SoftwareSerial port

void loop() // run over and over

  //expect a string like wer,qwe rty,123 456,hyre kjhg,
  //or like hello world,who are you?,bye!,
  while (Serial.available()) {
    delay(10);  //small delay to allow input buffer to fill

    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
    }  //breaks out of capture loop to print readstring
    readString += c;
  } //makes the string readString 

  if (readString.length() >0) {
    Serial.println(readString); //prints string to serial port out

    readString=""; //clears variable for new input


Many thanks

Go Up