Mega 2560 WiFi - error: 'PinStatus' does not name a type

I have a HiLetgo Mega 2560 board, with built in WiFi. When I attempt to include the WifiNINA library (by Arduino), I constantly get an error message when I try to compile: error: 'PinStatus' does not name a type

I've tried researching this online, and there's plenty of information - just nothing that seems to work for my board.

Grateful in advance for any advice on this one.

We can't see your code
We can't see your actual error messages.

This is NOT an installation and troubleshooting issue.

It's a compile issue.

No need to see my code - coding isn't the problem. (I code for a living) It's a known issue. I'm just not sure how it relates to the hardware that I'm using.

EDIT: If this is the wrong subforum, please feel free to move the post. I just didn't see another section that fit better.

Good luck.

(Maybe you could ask a mod to move this to a more appropriate forum section - I'm sure they're fed up of me keep flagging posts here)

Is this a variable some how familiar to you ? That is, have you written code which explicitly refers to it or is it something deeply buried in a library ?

The name of the subforum is somewhat misleading. It should (IMHO) be entitled "Installation Issues". Including Troubleshooting in the name is asking for trouble.

No, it isn't something that should be required for use. There are plenty of posts online that suggest that an update is required. Some people have luck, some don't. Upgrade, downgrade... I'm not having luck with either.

It's an error message that doesn't make sense in the context of the basic usage. And by basic, I'm talking about just including the library - not even making any calls to any of its functions.

The exact solution to the issue every time it pops up, seems to be hardware specific.

Well, without the means to reproduce your error, it looks like you're on your own.

...and still others have common-sense.

As I wrote earlier "good luck"
(Or "thoughts and prayers", if you prefer)

Are you sure the WifiNINA library is correct for that board?

Some of the newer board platforms use an enum for PinStatus instead of the traditional HIGH and LOW for digitalWrite, as well as for attaching interrupts. The board platform for the Mega likely does not support this, while WifiNINA is mostly used on the newer boards.

typedef enum {
  LOW     = 0,
  HIGH    = 1,
  CHANGE  = 2,
  FALLING = 3,
  RISING  = 4,
} PinStatus;

< edit > Does the HiLetgo Mega have an ESP8266 based wifi?

Agreed on the "common sense" part. Unless you have the exact board that I'm using, there's no point in undertaking it. As stated - NOT a code problem. If you have the board that I'm using, I'll happily post the code to include the WifiNINA library.

So can you duplicate the problem, with that information? If not, then thanks for your "help".

Yes sir.

As stated

We all have compilers.

Edit: I've just taken a look at some of your previous trolls over the past three years or so.
I'll leave you to your enormous sense of entitlement, and duck out of this one now

Someone with more knowledge than me will have to answer this, but I do not believe the WifiNINI library is compatible with the ESP8266.

Do you know what might be considered a better library for this board? The working example I saw for code using this library was with an MKR1000.

That will never be true. Flags away.

1 Like

Look for examples of using an ESP8266 board with an UNO/Mega. What you have is basically a Mega and ESP8266 built onto the same board, using one of the Mega's serial ports for communications between the two (provided you have the onboard DIP switches set correctly).

I can confirm that I do. I can upload to both the Arduino, and the ESP module.

I think the error means that you are using the wrong WiFi library for your board. There is no "Arduino" with an ATmega2560 and ESP8266. I think you will have to treat the ESP826 as a 'shield'.

This project uses an ESP8266 module connected to an Arduino MEGA 2560 via Serial1. It can probably be adapted to your hardware:

I think that you may be correct. I'm currently experimenting with the WifiEsp library.

For reference, this is the board that I have:

It sure seems like I've bricked this board. :laughing:

Good thing I always buy everything in triplicate...

This library allows you to use the Arduino UNO WiFi Rev.2, Arduino NANO 33 IoT, Arduino MKR 1010 and Arduino MKR VIDOR 4000 WiFi capabilities
Arduino - WiFiNINA

You are using the wrong library

Use WiFiEsp