Arduino does not print data to oled screen

I am uploading this code to arduino. The CODE is being printed but the data from the RF is not. I tested oled, it works fine. What should I do?`

#include <RCSwitch.h>
#include <OLED_I2C.h>

OLED  myOLED(SDA, SCL, 8);

extern uint8_t SmallFont[];

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(0);
  myOLED.begin();
  myOLED.setFont(SmallFont);
}

void loop() {
  if (mySwitch.available()) {
    long DATA = mySwitch.getReceivedValue();
    Serial.print("Received ");
    Serial.print( mySwitch.getReceivedValue() );
    Serial.print(" / ");
    Serial.print( mySwitch.getReceivedBitlength() );
    Serial.print("bit ");
    Serial.print("Protocol: ");
    Serial.println( mySwitch.getReceivedProtocol() );
    mySwitch.resetAvailable();
    Serial.println(DATA);
    myOLED.clrScr();
    myOLED.print(DATA, LEFT, 24);
    myOLED.print("CODE", CENTER, 16);
    myOLED.update();
  }
}

Welcome to the forum

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

What do you mean by this ?

sample
.....CODE ......
5657567657

What are you expecting to see ?

I want to print data from RF receiver to oled screen.

long DATA = mySwitch.getReceivedValue();

Please give an example of what you should see on the screen

I need to print the value 5592512 to the screen. Serial.println(DATA); When I type, it prints to the screen, but myOLED.print(DATA, LEFT, 24); When I type, no text appears on the screen.

It looks like the print function of the library only prints strings, but what you have is an integer so need to use the printNumI function instead

it worked thanks

If in doubt, and only as a last resort, RTFM :grinning:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.