Go Down

Topic: How to test if the CPU is DUE or not (Read 156 times) previous topic - next topic

LMI1

A neat way to test the CPU would be something like this, but DUE is not declared. How to do this?

Code: [Select]
#if defined(DUE)
  #define AAA
  #else
  #define BBB
  #endif



LMI1

#1
Feb 07, 2016, 05:46 pm Last Edit: Feb 07, 2016, 05:48 pm by LMI Reason: The missing link
This seems to work
Code: [Select]
//  #define (__SAM3X8E__)
  #if defined(__SAM3X8E__)
  char textt[]="due";
  #else
  char textt[]="enotdue";
  #endif
void setup() {
 Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
   Serial.println(textt);
}


I saw a warning about = and ; in defines, luckily I wrote the program first, because it seems to work.

Edit
I saw it here
http://electronics4dogs.blogspot.fi/2011/01/arduino-predefined-constants.html
But there were other hits too

Go Up