Hello, I am trying to send data from my android phone to my arduino via Bluetooth (HC-05) and display the data on an Oled. The pairing and everything works just fine, but when i send data (i was trying both numbers and letters) the screen displays symbols that have nothing to do with the message I send. When i let it print the received data it keeps returning 353535...
From what I´ve seen on the forum i know that the data has to be read digit by digit, saved and
put together using a loop with a counter, but I have no clue what this algorithm has to look like...
I would thankful for any help/tips
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SPI.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
int val;
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //initialize display
display.clearDisplay(); //clear buffer
Serial.begin(9600);
}
void loop() {
if( Serial.available() ) // if data is available to read
{
val = Serial.read();
} // read it and store it in 'val'
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(10,30);
display.print(val);
Serial.print(val);
display.display();
}