Go Down

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

LMI

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



LMI

#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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy