Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Purpose of "#if (ARDUINO >= 100) "
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Purpose of "#if (ARDUINO >= 100) "

by xsk8rat on Sat Apr 10, 2021 3:37 pm

In the MPRLS library (in Adafruit_MPRLS.cpp), there are a few lines of code i don't understand:
Code: Select all | TOGGLE FULL SIZE
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

What does this code do?
Thanks for any guidance or where to look for this information.
Thanks,
Mark

xsk8rat
 
Posts: 10
Joined: Thu Aug 21, 2014 12:43 am

Re: Purpose of "#if (ARDUINO >= 100) "

by dastels on Sat Apr 10, 2021 4:01 pm

At some point in the evolution of the Arduino framework (i.e. as off ARDUINO being 100) the header you have to include to bring inall the Arduino goodness changed. This code just keeps it backward compatible. My guess is that the code was around before that point in time and this was added to let it work with the newer version.

For your code you can simply
Code: Select all | TOGGLE FULL SIZE
#include "Arduino.h"


Dave

dastels
 
Posts: 6080
Joined: Tue Oct 20, 2015 3:22 pm

Re: Purpose of "#if (ARDUINO >= 100) "

by xsk8rat on Sat Apr 17, 2021 11:23 am

Thanks Dave!
Okay, that's interesting.

xsk8rat
 
Posts: 10
Joined: Thu Aug 21, 2014 12:43 am

Please be positive and constructive with your questions and comments.