Seeed-Studio / ArduinoCore-samd

49 stars 27 forks source link

DAC cannot output over 2.2V #7

Closed matsujirushi closed 4 years ago

matsujirushi commented 4 years ago

Board: Seeeduino XIAO

Code:

void setup() {
  pinMode(DAC0, OUTPUT);
}

void loop() {
  for (int i = 0; i < 1024; ++i)
  {
    analogWrite(DAC0, i);
    delay(1);
  }
}

Output: image

matsujirushi commented 4 years ago

I got the cause. Remove pinMode() call.

Code:

void setup() {
//  pinMode(DAC0, OUTPUT);
}

void loop() {
  for (int i = 0; i < 1024; ++i)
  {
    analogWrite(DAC0, i);
    delay(1);
  }
}

Output: image