Go Down

Topic: pinMode(SDA, OUTPUT); does not work in DUE (Read 2551 times) previous topic - next topic


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

For example this demonstrates the problem.

Spiced up Blink example.
Code: [Select]
#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



SDA and SCL are not defined.
Code: [Select]
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.


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.

Code: [Select]
  #if defined(DUE)
  pinMode(SDA, OUTPUT);


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
Code: [Select]
#if defined(__SAM3X8E__) instead?


UTFT_SdRaw now included in library manager!! ;) High speed image drawing from SD card to UTFT displays for Mega & DUE.
UTFT_GHL - a VASTLY upgraded version of UTFT_CTE. Coming soon to a TFT near you! 8) Shipping April 1 2016!


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.

Go Up