Complies in a Nano but not a Nano Every

I have a clock sketch using 60 Neopixel LEDs and a OLED display. The sketch compiles but doesn’t run in a Nano, it does in a Mega. I was running out of memory so it was recommended to try using a Nano Every. I added the Every using the board manager but now when it goes to compile I get the following error.

Arduino: 1.8.9 (Windows 10), Board: "Arduino Nano Every, ATMEGA328"

Build options changed, rebuilding all
In file included from C:\Users\lampo\Documents\Arduino\My_Test_Clock_OLED\My_Test_Clock_OLED.ino:4:0:

C:\Users\lampo\Documents\Arduino\libraries\FastLED\src/FastLED.h:14:21: note: #pragma message: FastLED version 3.004.000

 #    pragma message "FastLED version 3.004.000"


In file included from c:\users\lampo\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:677:0,

                 from c:\users\lampo\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,

                 from C:\Users\lampo\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/String.h:31,

                 from C:\Users\lampo\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/Print.h:24,

                 from C:\Users\lampo\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/Stream.h:25,

                 from C:\Users\lampo\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/Client.h:22,

                 from C:\Users\lampo\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/ArduinoAPI.h:29,

                 from C:\Users\lampo\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/Arduino.h:23,

                 from sketch\My_Test_Clock_OLED.ino.cpp:1:

My_Test_Clock_OLED:11:12: error: expected ')' before '*' token

 RTC_DS3231 RTC; // Establishes the chipset of the Real Time Clock


My_Test_Clock_OLED:11:12: error: expected ')' before '*' token

C:\Users\lampo\Documents\Arduino\My_Test_Clock_OLED\My_Test_Clock_OLED.ino: In function 'void setup()':

My_Test_Clock_OLED:45:7: error: 'RTC_t {aka struct RTC_struct}' has no member named 'begin'

   RTC.begin(); // Starts communications to the RTC


My_Test_Clock_OLED:53:22: error: 'RTC_t {aka struct RTC_struct}' has no member named 'now'

   DateTime now =;


C:\Users\lampo\Documents\Arduino\My_Test_Clock_OLED\My_Test_Clock_OLED.ino: In function 'void loop()':

My_Test_Clock_OLED:73:22: error: 'RTC_t {aka struct RTC_struct}' has no member named 'now'

   DateTime now =; // Fetches the time from RTC


C:\Users\lampo\Documents\Arduino\My_Test_Clock_OLED\My_Test_Clock_OLED.ino: In function 'void updateDisplay()':

My_Test_Clock_OLED:113:22: error: 'RTC_t {aka struct RTC_struct}' has no member named 'now'

   DateTime now =; // Fetches the time from RTC


exit status 1
expected ')' before '*' token

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I have read of others having similar problems but none seem to be what this problem is. Here’s my sketch

// My test clock
// added OLED display

#include <FastLED.h> // FastSPI Library from
#include <Wire.h> //This is to communicate via I2C. On arduino Uno & Nano use pins A4 for SDA (yellow/orange) and A5 for SCL (green). For other boards ee
#include <RTClib.h>           // Include the RTClib library to enable communication with the real time clock.
// Include Adafruit Graphics & OLED libraries
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

RTC_DS3231 RTC; // Establishes the chipset of the Real Time Clock

// Reset pin not used but needed for library
#define OLED_RESET 4
//Adafruit_SSD1306 display(OLED_RESET);
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32

#define LEDStripPin 6 // Pin used for the data to the LED strip
#define menuPin 0 // Pin used for the menu button (green stripe)
#define numLEDs 60 // Number of LEDs in strip

// Setting up the LED strip
struct CRGB leds[numLEDs];

int timeHour;
int timeMin;
int timeSec;
int LEDOffset = 0;

long int updateTime = millis();
int updateDelay = 1000;

void setup() {

  // Start LEDs
  LEDS.addLeds<WS2811, LEDStripPin, GRB>(leds, numLEDs); // Structure of the LED data. I have changed to from rgb to grb, as using an alternative LED strip. Test & change these if you're getting different colours.

  // Start RTC
  Wire.begin(); // Starts the Wire library allows I2C communication to the Real Time Clock
  RTC.begin(); // Starts communications to the RTC

  // initialize OLED with I2C addr 0x3C
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

  Serial.begin(9600); // Starts the serial communications

  // create a loop that calcuated the number of counted milliseconds between each second.
  DateTime now =;

  Serial.print("Hour time is... ");
  Serial.print("Min time is... ");
  Serial.print("Sec time is... ");

  Serial.print("Year is... ");
  Serial.print("Month is... ");
  Serial.print("Day is... ");

} // end void setup

void loop() {

  DateTime now =; // Fetches the time from RTC

  // clear LED array
  memset(leds, 0, numLEDs * 3);

  unsigned char hourPos = ((now.hour() % 12) * 5 + (now.minute() + 6) / 12);

  leds[(hourPos + LEDOffset + 59) % 60].r = 255;
  leds[(hourPos + LEDOffset + 59) % 60].g = 0;
  leds[(hourPos + LEDOffset + 59) % 60].b = 0;
  leds[(hourPos + LEDOffset) % 60].r = 255;
  leds[(hourPos + LEDOffset) % 60].g = 0;
  leds[(hourPos + LEDOffset) % 60].b = 0;
  leds[(hourPos + LEDOffset + 1) % 60].r = 255;
  leds[(hourPos + LEDOffset + 1) % 60].g = 0;
  leds[(hourPos + LEDOffset + 1) % 60].b = 0;
  leds[(now.minute() + LEDOffset) % 60].r = 0;
  leds[(now.minute() + LEDOffset) % 60].g = 255;
  leds[(now.minute() + LEDOffset) % 60].b = 0;

  leds[(now.second() + LEDOffset) % 60].r = 0;
  leds[(now.second() + LEDOffset) % 60].g = 0;
  leds[(now.second() + LEDOffset) % 60].b = 255;

  // Update LEDs;

  if (millis() > (updateTime + updateDelay))
    updateTime = millis();

  } // end updateDisplay time

} // end void loop

void updateDisplay() {

  DateTime now =; // Fetches the time from RTC

  // Clear the display
  //Set the color - always use white despite actual display color
  //Set the font size
  //Set the cursor coordinates
  display.setCursor(0, 10);
  // display.print("Time");
  display.setCursor(10, 15);

  display.setCursor(0, 40);
  //  display.print(F("Date"));
  display.setCursor(10, 45);

  display.display(); // Update screen

} // end updateDisplay


Thanks for the help

I think your "RTC" object is having a name collision with something from the Arduino megaAVR Boards platform. Try renaming it to something more unique.

@pert, that took care of the compiling problem. What did you see in the error message that told you that was the problem?

The clock is reading right and displaying the correct time and date on the OLED but now the LED's aren't moving around as the clock hands as it was.

Thanks for the help

I'm not Per but would have seen the same issue immediately. You see all these errors, all in relationship to something named RTC - okay, so it's gotta be something related the that....

And you've got

but it's saying that RTC is an RTC_t {aka struct RTC_struct}

How could that be! It should be an RTC_DS3231, that's what you just declared it as - except you got a very strange error from that line too...

On the post-2016 AVR processors, all the types of on-chip peripherals have a struct type associated with them (PERIPHERALTYPE_t), and an instance of that struct for each of the peripherals, with it's address declared such that you can do PERIPHERAL.REGISTER = new_value to configure it. And so when you see something having a type of ALLCAPS_t when that surprises you, and ALLCAPS could be an on-chip peripheral, that's what you should look at. Also, I (and I suspect pert as well) know off the top of my head that RTC is the name of the on-chip RTC on the new parts, so that jumps out at me.

Because the definition of RTC is a #define, it is basically find+replace by the preprocessor.
The declaration gets turned into this piece of nonsense

RTCDS3231 (*(RTC_t *) 0x0140);

and you get an error about expecting a ) before a * pointing to a line that contains neither of those characters; not the most helpful message I daresay...

You're right about it not being a helpful message. I've gotten a similar message when I forget to put a semi colon at the end of a line or accidently delete a bracket. I spent about an hour looking for something like that. Thanks for the detailed explanation.

Thanks @DrAzzy!

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