Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user

I am working with a combination of Teensy++ 2.0 (https://www.pjrc.com/store/teensyppTeensy++ 2.html0) and Sparkfun Bluetooth Modem (https://www.sparkfun.com/products/12577Sparkfun Bluetooth Modem). The arduino

The Arduino program, inside the loop, continuously reads a sensor value. If the value read is above a threshold, the arduinoArduino transmits a "CHARACTER" over Bluetooth for any receiver. So

So, inside the same loop, I check for the availability of data, and print the received character. The problem is, the received character is not what is transmitted. The received character is some garbage value. Please

Please let me know what is going wrong here.

#include <SoftwareSerial.h>

#define bluetooth Serial1

#define BAUDRATE 9600

// Analog read 0 is pin 38 
int sensorValue = 0;
int SENSOR_ANALOG_READ_PIN = 0;
int LED = 17;

char toPrint = '\0';
bool sent = false;
char state = ' ';

void setup() 
{
  
// put your setup code here, to run once:

  pinMode(LED, OUTPUT);

  Serial.begin(BAUDRATE);

  bluetooth.begin(BAUDRATE);

}


void loop() {

  
  // put your main code here, to run repeatedly:

  sensorValue = analogRead(SENSOR_ANALOG_READ_PIN);


  if(value > 500)

  {
      //Serial.println("HIGH");

      digitalWrite(LED, HIGH);

      bluetooth.write(state);

      bluetooth.flush();

      sent = true;

      digitalWrite(LED, LOW);

  }

  else

  {

      delay(100);

  }

  ///////////////////////////////////////////////////////////
  if((bluetooth.available()) && (sent == true))

  {

        Serial.println("printing : ");

        toPrint = (char)bluetooth.read();

        Serial.println((char)toPrint);

        sent = false;

   }

}

Output:

printing : 
1
printing : 
ˆ
printing : 
Ì
printing : 
¦
printing : 
È
printing : 
Ì
printing : 
Ì
printing : 

I am working with a combination of Teensy++ 2.0 (https://www.pjrc.com/store/teensypp.html) and Sparkfun Bluetooth Modem (https://www.sparkfun.com/products/12577). The arduino program, inside the loop, continuously reads a sensor value. If the value read is above a threshold, the arduino transmits a "CHARACTER" over Bluetooth for any receiver. So, inside the same loop, I check for the availability of data, and print the received character. The problem is, the received character is not what is transmitted. The received character is some garbage value. Please let me know what is going wrong here.

#include <SoftwareSerial.h>

#define bluetooth Serial1

#define BAUDRATE 9600

// Analog read 0 is pin 38 
int sensorValue = 0;
int SENSOR_ANALOG_READ_PIN = 0;
int LED = 17;

char toPrint = '\0';
bool sent = false;
char state = ' ';

void setup() 
{
  
// put your setup code here, to run once:

  pinMode(LED, OUTPUT);

  Serial.begin(BAUDRATE);

  bluetooth.begin(BAUDRATE);

}


void loop() {

  
  // put your main code here, to run repeatedly:

  sensorValue = analogRead(SENSOR_ANALOG_READ_PIN);


  if(value > 500)

  {
      //Serial.println("HIGH");

      digitalWrite(LED, HIGH);

      bluetooth.write(state);

      bluetooth.flush();

      sent = true;

      digitalWrite(LED, LOW);

  }

  else

  {

      delay(100);

  }

  ///////////////////////////////////////////////////////////
  if((bluetooth.available()) && (sent == true))

  {

        Serial.println("printing : ");

        toPrint = (char)bluetooth.read();

        Serial.println((char)toPrint);

        sent = false;

   }

}

Output:

printing : 
1
printing : 
ˆ
printing : 
Ì
printing : 
¦
printing : 
È
printing : 
Ì
printing : 
Ì
printing : 

I am working with a combination of Teensy++ 2.0 and Sparkfun Bluetooth Modem.

The Arduino program, inside the loop, continuously reads a sensor value. If the value read is above a threshold, the Arduino transmits a "CHARACTER" over Bluetooth for any receiver.

So, inside the same loop, I check for the availability of data, and print the received character. The problem is, the received character is not what is transmitted. The received character is some garbage value.

Please let me know what is going wrong here.

#include <SoftwareSerial.h>

#define bluetooth Serial1

#define BAUDRATE 9600

// Analog read 0 is pin 38 
int sensorValue = 0;
int SENSOR_ANALOG_READ_PIN = 0;
int LED = 17;

char toPrint = '\0';
bool sent = false;
char state = ' ';

void setup() 
{
  
// put your setup code here, to run once:

  pinMode(LED, OUTPUT);

  Serial.begin(BAUDRATE);

  bluetooth.begin(BAUDRATE);

}


void loop() {

  
  // put your main code here, to run repeatedly:

  sensorValue = analogRead(SENSOR_ANALOG_READ_PIN);


  if(value > 500)

  {
      //Serial.println("HIGH");

      digitalWrite(LED, HIGH);

      bluetooth.write(state);

      bluetooth.flush();

      sent = true;

      digitalWrite(LED, LOW);

  }

  else

  {

      delay(100);

  }

  ///////////////////////////////////////////////////////////
  if((bluetooth.available()) && (sent == true))

  {

        Serial.println("printing : ");

        toPrint = (char)bluetooth.read();

        Serial.println((char)toPrint);

        sent = false;

   }

}

Output:

printing : 
1
printing : 
ˆ
printing : 
Ì
printing : 
¦
printing : 
È
printing : 
Ì
printing : 
Ì
printing : 
added 263 characters in body; edited title
Source Link
Gerben
  • 11.3k
  • 3
  • 22
  • 34

Having issues with Arduino + Bluetooth [ Code attached ]

I am working with a combination of Teensy++ 2.0 (https://www.pjrc.com/store/teensypp.html) and Sparkfun bluetooth Modem (https://www.sparkfun.com/products/12577). The arduino program, inside the loop, continuously reads a sensor value. If the value read is above a threshold, the arduino transmits a "CHARACTER" over bluetooth for any receiver. So, inside the same loop, I check for the availability of data, and print the received character. The problem is, the received character is not what is transmitted. The received character is some garbage value. Please let me know what is going wrong here.

#include <SoftwareSerialI am working with a combination of Teensy++ 2.h>

#define bluetooth Serial1

#define BAUDRATE 9600

// Analog read 0 is pin 38 int sensorValue = 0; int SENSOR_ANALOG_READ_PIN = 0; int LED = 17;

char toPrint = '\0'; bool sent = false; char state = ' ';

void setup0 (https://www.pjrc.com/store/teensypp.html) and Sparkfun Bluetooth Modem (https://www.sparkfun.com/products/12577). {

// put your setup code hereThe arduino program, to run once:

pinMode(LEDinside the loop, OUTPUT);

Serialcontinuously reads a sensor value.begin(BAUDRATE);

bluetooth If the value read is above a threshold, the arduino transmits a "CHARACTER" over Bluetooth for any receiver.begin(BAUDRATE);

}

void So, inside the same loop() {

// put your main code here, to run repeatedly:

sensorValue = analogRead(SENSOR_ANALOG_READ_PIN);

if(value > 500)

{I check for the availability of data, and print the received character. The problem is, the received character is not what is transmitted. The received character is some garbage value. //SerialPlease let me know what is going wrong here.println("HIGH");

#include <SoftwareSerial.h>

#define bluetooth Serial1

#define BAUDRATE 9600

// Analog read 0 is pin 38 
int sensorValue = 0;
int SENSOR_ANALOG_READ_PIN = 0;
int LED = 17;

char toPrint = '\0';
bool sent = false;
char state = ' ';

void setup() 
{
  
// put your setup code here, to run once:

  pinMode(LED, OUTPUT);

  Serial.begin(BAUDRATE);

  bluetooth.begin(BAUDRATE);

}


void loop() {

  
  // put your main code here, to run repeatedly:

  sensorValue = analogRead(SENSOR_ANALOG_READ_PIN);


  if(value > 500)

  {
      //Serial.println("HIGH");

      digitalWrite(LED, HIGH);

      bluetooth.write(state);

      bluetooth.flush();

      sent = true;

      digitalWrite(LED, LOW);

}

else

{


  }

  else

  {

      delay(100);

}

/////////////////////////////////////////////////////////// if((bluetooth.available()) && (sent == true))

{


  }

  ///////////////////////////////////////////////////////////
  if((bluetooth.available()) && (sent == true))

  {

        Serial.println("printing : ");

        toPrint = (char)bluetooth.read();

        Serial.println((char)toPrint);

        sent = false;

   }

}

}

}


Output

printing : 1 printing : ˆ printing : Ì printing : ¦ printing : È printing : Ì printing : Ì printing :

printing : 
1
printing : 
ˆ
printing : 
Ì
printing : 
¦
printing : 
È
printing : 
Ì
printing : 
Ì
printing : 

Having issues with Arduino + Bluetooth [ Code attached ]

I am working with a combination of Teensy++ 2.0 (https://www.pjrc.com/store/teensypp.html) and Sparkfun bluetooth Modem (https://www.sparkfun.com/products/12577). The arduino program, inside the loop, continuously reads a sensor value. If the value read is above a threshold, the arduino transmits a "CHARACTER" over bluetooth for any receiver. So, inside the same loop, I check for the availability of data, and print the received character. The problem is, the received character is not what is transmitted. The received character is some garbage value. Please let me know what is going wrong here.

#include <SoftwareSerial.h>

#define bluetooth Serial1

#define BAUDRATE 9600

// Analog read 0 is pin 38 int sensorValue = 0; int SENSOR_ANALOG_READ_PIN = 0; int LED = 17;

char toPrint = '\0'; bool sent = false; char state = ' ';

void setup() {

// put your setup code here, to run once:

pinMode(LED, OUTPUT);

Serial.begin(BAUDRATE);

bluetooth.begin(BAUDRATE);

}

void loop() {

// put your main code here, to run repeatedly:

sensorValue = analogRead(SENSOR_ANALOG_READ_PIN);

if(value > 500)

{ //Serial.println("HIGH");

  digitalWrite(LED, HIGH);

  bluetooth.write(state);

  bluetooth.flush();

  sent = true;

  digitalWrite(LED, LOW);

}

else

{

  delay(100);

}

/////////////////////////////////////////////////////////// if((bluetooth.available()) && (sent == true))

{

    Serial.println("printing : ");

    toPrint = (char)bluetooth.read();

    Serial.println((char)toPrint);

    sent = false;

}

}


Output

printing : 1 printing : ˆ printing : Ì printing : ¦ printing : È printing : Ì printing : Ì printing :

Having issues with Arduino + Bluetooth

I am working with a combination of Teensy++ 2.0 (https://www.pjrc.com/store/teensypp.html) and Sparkfun Bluetooth Modem (https://www.sparkfun.com/products/12577). The arduino program, inside the loop, continuously reads a sensor value. If the value read is above a threshold, the arduino transmits a "CHARACTER" over Bluetooth for any receiver. So, inside the same loop, I check for the availability of data, and print the received character. The problem is, the received character is not what is transmitted. The received character is some garbage value. Please let me know what is going wrong here.

#include <SoftwareSerial.h>

#define bluetooth Serial1

#define BAUDRATE 9600

// Analog read 0 is pin 38 
int sensorValue = 0;
int SENSOR_ANALOG_READ_PIN = 0;
int LED = 17;

char toPrint = '\0';
bool sent = false;
char state = ' ';

void setup() 
{
  
// put your setup code here, to run once:

  pinMode(LED, OUTPUT);

  Serial.begin(BAUDRATE);

  bluetooth.begin(BAUDRATE);

}


void loop() {

  
  // put your main code here, to run repeatedly:

  sensorValue = analogRead(SENSOR_ANALOG_READ_PIN);


  if(value > 500)

  {
      //Serial.println("HIGH");

      digitalWrite(LED, HIGH);

      bluetooth.write(state);

      bluetooth.flush();

      sent = true;

      digitalWrite(LED, LOW);

  }

  else

  {

      delay(100);

  }

  ///////////////////////////////////////////////////////////
  if((bluetooth.available()) && (sent == true))

  {

        Serial.println("printing : ");

        toPrint = (char)bluetooth.read();

        Serial.println((char)toPrint);

        sent = false;

   }

}

Output:

printing : 
1
printing : 
ˆ
printing : 
Ì
printing : 
¦
printing : 
È
printing : 
Ì
printing : 
Ì
printing : 
Source Link

Having issues with Arduino + Bluetooth [ Code attached ]

I am working with a combination of Teensy++ 2.0 (https://www.pjrc.com/store/teensypp.html) and Sparkfun bluetooth Modem (https://www.sparkfun.com/products/12577). The arduino program, inside the loop, continuously reads a sensor value. If the value read is above a threshold, the arduino transmits a "CHARACTER" over bluetooth for any receiver. So, inside the same loop, I check for the availability of data, and print the received character. The problem is, the received character is not what is transmitted. The received character is some garbage value. Please let me know what is going wrong here.

#include <SoftwareSerial.h>

#define bluetooth Serial1

#define BAUDRATE 9600

// Analog read 0 is pin 38 int sensorValue = 0; int SENSOR_ANALOG_READ_PIN = 0; int LED = 17;

char toPrint = '\0'; bool sent = false; char state = ' ';

void setup() {

// put your setup code here, to run once:

pinMode(LED, OUTPUT);

Serial.begin(BAUDRATE);

bluetooth.begin(BAUDRATE);

}

void loop() {

// put your main code here, to run repeatedly:

sensorValue = analogRead(SENSOR_ANALOG_READ_PIN);

if(value > 500)

{ //Serial.println("HIGH");

  digitalWrite(LED, HIGH);

  bluetooth.write(state);

  bluetooth.flush();

  sent = true;

  digitalWrite(LED, LOW);

}

else

{

  delay(100);

}

/////////////////////////////////////////////////////////// if((bluetooth.available()) && (sent == true))

{

    Serial.println("printing : ");

    toPrint = (char)bluetooth.read();

    Serial.println((char)toPrint);

    sent = false;

}

}


Output

printing : 1 printing : ˆ printing : Ì printing : ¦ printing : È printing : Ì printing : Ì printing :