Hi,
I'm trying to show data from a Bluetooth device on an OLED.
I first used an HC-06 and an Android phone. This works great. I can send words from an APP and the Arduino shows them on the OLED.
Now I switched from the Android to an Multimeter. Because of that I had to change my Bluetooth module. I now use an HM-11 which I can use in Master mode.
I did set it up wit the AT commands. Therefore I connected it to the pc directly using a TTL converter. I got it to work like I wanted. When it turns on it automatically connects and then shows the reciving data.
I now connected it to the Arduino. My Idea is that the HM-11 sends the recived data to the Arduino which shows it on the OLED.
I don't know why but it doesent show any of the data on the OLED. If I use the HC-06 it does. That's why I think the problem ist when the HM-11 needs to transmit the data to the Arduino.
Sadly I can't figure out where the Problem is.
Maybe someone can help?
Thats the code Im using
include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>#include <SPI.h>
#include <Wire.h>int ledPin = 13;
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
static const unsigned char PROGMEM logo16_glcd_bmp[] = { B00000000, B11000000, B00000001, B11000000, B00000001, B11000000, B00000011, B11100000, B11110011, B11100000, B11111110, B11111000, B01111110, B11111111, B00110011, B10011111, B00011111, B11111100, B00001101, B01110000, B00011011, B10100000, B00111111, B11100000, B00111111, B11110000, B01111100, B11110000, B01110000, B01110000, B00000000, B00110000 };
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
char Incoming_value = 0; //Variable for storing Incoming_value
void setup(void) {
Serial.begin(9600);
pinMode(13, OUTPUT);display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64) // init done // Show image buffer on the display hardware.
display.display(); //delay(2000);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(50, 5);
display.clearDisplay();
display.println("3,5V");
// invert the display
display.invertDisplay(true);
display.invertDisplay(false);
display.display();
delay(500);
display.clearDisplay(); }
void loop() {
if(Serial.available() > 0)
{
Incoming_value = Serial.read(); //Read the incoming data and store it into variable Incoming_value
Serial.print(Incoming_value); //Print Value of Incoming_value in Serial monitor
Serial.print("\n"); //New linedisplay.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(50, 5);
display.clearDisplay();
display.println(Incoming_value);
display.display();}
}