How to make blinking bitmap stable on OLED after bluetooth module is connected to a device?
5 views (last 30 days)
Show older comments
Hey there!
I am actually making a code to display/indicate the connectivity of the bluetooth module on an OLED display. My code works fine only for once when it is uploaded. The Bluetooth bitmap starts blinking once the code is uploaded. after when i connect my bluetooth module to my android's bluetooth, the bluetooth gets stable successfully. But when i disconnect the bluetooth, the bitmap is supposed to shift to the blinking state, but is stays stable. I don't know how to resolve it. It would be great if anyone of you helps! thank you.
void setup() {
bt.begin(9600);
Serial.begin(9600);
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
display.clearDisplay();
}
void loop() {
display.clearDisplay();
display.drawBitmap(
(display.width() + LOGO_WIDTH+90 ) / 2,
(display.height() - LOGO_HEIGHT-75) / 12,
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
display.display();
delay(500);
display.clearDisplay();
display.drawBitmap(
(display.width() + LOGO_WIDTH+1000000) / 2,
(display.height() - LOGO_HEIGHT-1000000) / 12,
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
display.display();
delay(500);
if (bt.available()>0){
while (bt.available()) /* If data is available on serial port */
{
display.clearDisplay();
display.drawBitmap(
(display.width() + LOGO_WIDTH+90 ) / 2,
(display.height() - LOGO_HEIGHT-75) / 12,
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
display.display();
delay(-1);
display.clearDisplay();
}
}
}
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!