pinMode(SDA, OUTPUT); does not work in DUE

But it works with Arduino Mega and Duemilanove and probably others.

For example this demonstrates the problem.

Spiced up Blink example.

#include <Wire.h>

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
  pinMode(SDA, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

What do you mean "does not work"?

Mark

SDA and SCL are not defined.

Arduino: 1.6.7 (Windows 7), Board: "Arduino Due (Programming Port)"

Build options changed, rebuilding all
C:\Users\LM7\AppData\Local\Temp\arduino_f8131f8621ef0212e390fd4794e3005c\Blink.ino: In function 'void setup()':

Blink:7: error: 'SDA' was not declared in this scope

   pinMode(SDA, OUTPUT);

           ^

exit status 1
'SDA' was not declared in this scope

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

The SAM and SAMD cores define PIN_WIRE_SDA instead of SDA.

oqibidipo:
The SAM and SAMD cores define PIN_WIRE_SDA instead of SDA.

Yes. That was it.

By the way, in my example in the first post, the "#include <Wire.h>" is not necessary.

  1. Is there any easy way to see what is currently defined by the IDE.

  2. What is wrong with this? If I "verify" or compile for DUE, I get not declared error.

  #if defined(DUE)
  pinMode(PIN_WIRE_SDA, OUTPUT);
  #else
  pinMode(SDA, OUTPUT);
  #endif

I think I managed to modify the library, but the sensor does not work.

Part of the problem was that the IDE had somehow crashed, libraries were mixed. I got error messages from other libraries which were not even included in the sketch.

I think maybe you should try #if defined(__SAM3X8E__) instead?

Regards,

Graham

Yes. That is the best way to handle that problem. But after a long battle with various problems, I think that did not solve my original problem. That is DUE and the 90614 together.