Hi
I am trying to have a faster way of logging the data captured from Uno through a Seeeduino BT shield.
I gathered from the following website that it is quite possible with the Newsoftserial library, which is integrated already as Softwareserial in Arduino 1.0 version upwards.
However, any change in default baud rate of 38400 (upwards or downwards) doesnt let pass the code and as a result there is no way I can log the data faster!
Is there a solution?
I would also like to know about the 2s delay, in the program. To what extent we can alter it and what impact it does
I am including this small piece of sketch:
#include <SoftwareSerial.h> //Software Serial Port
#define RxD 7
#define TxD 6
#define DEBUG_ENABLED 1
#define sensor1 A3
SoftwareSerial blueToothSerial(RxD,TxD);
float analog_value()
{
int a = analogRead(sensor1);
float sensor1_value = (float)a*5/1023;
return sensor1_value;
}
void setup()
{
Serial.begin(9600);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
pinMode(sensor1, INPUT);
setupBlueToothConnection();
}
void loop()
{
blueToothSerial.print("sensor1_value: ");
blueToothSerial.println(analog_value());
delay (1000);
}
void setupBlueToothConnection()
{
blueToothSerial.begin(38400); // Set BluetoothBee BaudRate to default baud rate 38400
blueToothSerial.print("\r\n+STWMOD=0\r\n"); // set the bluetooth work in slave mode
blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); // set the bluetooth name as “SeeedBTSlave”
blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
delay(2000); // This delay is required.
blueToothSerial.print("\r\n+INQ=1\r\n"); // make the slave bluetooth inquirable
Serial.println(“The slave bluetooth is inquirable!”);
delay(2000); // This delay is required.
blueToothSerial.flush();
}
Any hint is appreciated.
Thanks