Can DAC and CAN pins in Arduino Due be used as digital input?

This topic is not a question but a sharing to those who are wondering about this. I did a test and the answer is yes to all four pins. However, I didn't test for the interrupt function. The circuit is connected from each pin to the ground and the pins used an internal pull-up function.


  Reads a digital input on pin 2, prints the result to the Serial Monitor

  This example code is in the public domain.

// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 69;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  // make the pushbutton's pin an input:
  pinMode(pushButton, INPUT);
  digitalWrite(pushButton, HIGH);

// the loop routine runs over and over again forever:
void loop() {
  // read the input pin:
  int buttonState = digitalRead(pushButton);
  // print out the state of the button:
  delay(1000);        // delay in between reads for stability

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.