SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By tunaman4u2
#195599
I HATE asking for help but Ive tried for months to try to write code based on various examples to get my Flexiforce FSR data from a redboard with a BlueSmirf to another redboard with a Bluesmirf. Im a physical therapist trying to make a strength tester so code is NOT my expertise. I would REALLY appreciate & reward any help to get me out of this roadblock & back to creating & testing the new product with patients! I can get my serial monitor to on my send Redboard to read my FSR just fine, I just cant get it on the other end.

Heres my SEND code

#include <SoftwareSerial.h>

int bluetoothTx = 2; // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 3; // RX-I pin of bluetooth mate, Arduino D3

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

int flexiForcePin = A0;


void setup()
{
Serial.begin(9600); // Begin the serial monitor at 9600bps
bluetooth.begin(115200); // The Bluetooth Mate defaults to 115200bps
bluetooth.println("U,9600,N"); // Temporarily Change the baudrate to 9600, no parity
// 115200 can be too fast at times for NewSoftSerial to relay the data reliably
bluetooth.begin(9600); // Start bluetooth serial at 9600
}

void loop()
{
int flexiForceReading = analogRead(flexiForcePin);
delay(1000);
Serial.println (flexiForceReading);
bluetooth.println (flexiForceReading);
}

Heres my Receive Code

// SoftwareSerial - Version: Latest
#include <SoftwareSerial.h>

int bluetoothTx = 2; // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 3; // RX-I pin of bluetooth mate, Arduino D3

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
Serial.begin(9600); // Begin the serial monitor at 9600bps

bluetooth.begin(115200); // The Bluetooth Mate defaults to 115200bps

bluetooth.println("U,9600,N"); // Temporarily Change the baudrate to 9600, no parity
// 115200 can be too fast at times for NewSoftSerial to relay the data reliably
bluetooth.begin(9600); // Start bluetooth serial at 9600
}

void loop()
{
if(bluetooth.available()) // If the bluetooth sent any characters
{
// Send any characters the bluetooth prints to the serial monitor
Serial.print((char)bluetooth.read());
}
if(Serial.available()) // If stuff was typed in the serial monitor
{
// Send any characters the Serial monitor prints to the bluetooth
bluetooth.print((char)Serial.read());
}

}