Hello,
I have been researching and looking through forum posts, but have not been able to find a solution unless I have been searching for it the wrong way.
I am building a transmitter and receiver module, with two Arduino Uno's. They are already successfully communicating with one another and display the right code in their own serial monitors. Transmitter serial monitor will display "Signal Sent", Receiver serial monitor will display "Signal Received: Message", "Message", is what is being sent from transmitter to receiver. What I am trying to do now is incorporate an OLED display for each Arduino. I am using a 1.3" IIC (4 pins - VCC, GND, SCL, SDA).
Is it possible for the OLED to display the given messages instead of on the serial monitor? Basically want to use the OLED display as my "serial monitor" for each Arduino.
Thank you for your feedback!
NOTES
I have the OLED connected to the 3.3V power supply so that the transmitter and receiver have the 5V supply (this way worked best in my application, the transmitter and receiver stopped communicating otherwise). I tried implementing basic code to display my name, on the Transmitter it would work, but on the receiver, it would either mess up my Receiver serial monitor, or it would not display my name on the OLED display. Or it would display my name, but add extra unknown characters to the Receiver's serial monitor (i.e. "Signal Received: Message??!#").
Here is the transmitter code:
#include <Wire.h> //Includes conncetion and interface with Arduino
#include <RH_ASK.h> // Include the RH_ASK library
#include <SPI.h> // Not actually used but needed to compile the RH_ASK library
//OLED portion
#include "U8glib.h"
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);
RH_ASK radio(2000, 11, 12);
//OLED draw function
///*
void draw(void) {
u8g.setFont(u8g_font_profont11);
u8g.setPrintPos(0, 10);
u8g.print("BEAST88");
}
//*/
void setup()
{
Serial.begin(9600); // Use this for debugging
// Speed of 2000 bits per second
if (!radio.init())
{
Serial.println("Radio module failed to initialize");
}
}
void loop()
{
// Create our message
const char *msg = "";
// Send our message
radio.send((uint8_t*)msg, strlen(msg));
// Wait until the data has been sent
radio.waitPacketSent();
delay(1000);
// Also inform the serial port that we are done
Serial.println("Signal Sent");
//OLED calling Draw function
u8g.firstPage();
do {
draw();
} while (u8g.nextPage() );
}
Here is the receiver code: (commented out sections are where I have tried to display on the OLED but it did not work properly)
#include <RH_ASK.h>
#include <SPI.h>
//OLED portion
#include "U8glib.h"
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);
RH_ASK radio;
//OLED draw function
/*
void draw(void) {
u8g.setFont(u8g_font_profont11);
u8g.setPrintPos(0, 10);
u8g.print("BEAST88");
}
//*/
void setup()
{
Serial.begin(9600);
// Speed of 2000 bits per second
if (!radio.init())
{
Serial.println("Radio module failed to initialize");
}
}
void loop()
{
// Create a 32 byte char buffer
uint8_t receive_buffer[34];
uint8_t buflen = sizeof(receive_buffer);
// If data is available, print it
if (radio.recv(receive_buffer, &buflen))
{
Serial.print("Signal Received: ");
Serial.println((char*)receive_buffer);
}
/*
u8g.firstPage();
do {
draw();
} while (u8g.nextPage() );
//*/
}