Jacco Veldscholten
Jacco Veldscholten

Reputation: 95

Arduino error: expected primary-expression before '.' token

I received a error from Arduino. And i'm very new into this kind of coding. (C) So, i received my first error on the IDE. But i have no idea how to fix it. I checked google, but nothing seems to work.

I bought a LED&Key chip for Arduino Mega. With the libary. I added the libary, and the functions are working. But, when i want to make my own code from scratch.. I received the error:

error: expected primary-expression before '.' token

And i have no idea how to fix it? And why?

This is my code:

#include <InvertedTM1638.h>
#include <TM1638.h>
#include <TM1640.h>
#include <TM16XX.h>
#include <TM16XXFonts.h>

#define module

TM1638 modules[] = {
    TM1638(8, 9, 7),
    TM1638(8, 9, 6),
    TM1638(8, 9, 5),
    TM1638(8, 9, 4)
};

void setup() {

    module.setDisplayToHexNumber(0x0a1a, 1);
    module.setLED(TM1638_COLOR_GREEN, 0);

}

void loop() {


}

Can i anyone tell me what is my fault? So i can keep up and starting with Coding for arduino!

Thanks!

Upvotes: 0

Views: 8554

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799580

You define module to be nothing, and then attempt to call a method on it. This will not work. Either give it a valid definition or do not attempt to use it.

Upvotes: 1

Related Questions