Go Down

Topic: Flora and Bluetooth connection display error (Read 131 times) previous topic - next topic

melindastannah

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include <SoftwareSerial.h>
#ifndef PSTR
 #define PSTR // Make Arduino Due happy
#endif
#define PIN 6
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(8, 8, PIN,
  NEO_MATRIX_BOTTOM     + NEO_MATRIX_LEFT +
  NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
  NEO_GRB            + NEO_KHZ800);
const uint16_t colors[] = {
  matrix.Color(255, 0, 0), matrix.Color(0, 255, 255), matrix.Color(0, 0, 255) };
SoftwareSerial BTserial(9,6); // RX | TX
String readString="";
char c;
void setup() {
  Serial.begin(9600);
  Serial.println("Starting: ");
  BTserial.begin(9600); 
    matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(20);
  matrix.setTextColor(colors[2]);
  }
int x    = matrix.width();
int pass = 0;
void loop() {
  String rcvdString="";
  Serial.print("start ");
  while (BTserial.available())
  {
    delay(3);
    Serial.print("Connected ");
    c = BTserial.read();
    Serial.println(c, DEC);
    rcvdString += (char)(c);
  } // end while

  if (rcvdString.length() > 0) {
    Serial.print("Received: ");
    Serial.println(readString);
    readString=rcvdString; 
  }
 
  matrix.fillScreen(0);
  matrix.setCursor(x, 0);
  matrix.print(readString);
  if(--x < -50) {
    x = matrix.width();
    if(++pass >= 3) pass = 0;
    matrix.setTextColor(colors[1]);
  }
  matrix.show();
  delay(200);
}



Using a FLORA Arduino, Bluetooth HC-05 and an  8*8 matrix LED matrix and the above code,
I am getting weird characters in display when a message is sent from my android phone using an app(via Bluetooth)
The serial monitor shows data received as square boxes instead of a text message
can I know why I am getting them?
Please help

PaulRB

#1
Sep 09, 2017, 04:03 pm Last Edit: Sep 09, 2017, 04:06 pm by PaulRB
Does all the text on serial monitor appear as boxes, or just the characters received from the Bluetooth adaptor? Can you see the words "Connected" and "Received" ok?

PS. You must post code in code tags so that it looks like
Code: [Select]
this
Please edit your post above and correct that.

Post the output you see on serial monitor (use code tags for that also).

Go Up