error on analogReference when moving from Teensy 3.2 to 4.0

jrdarrah

Well-known member
I'm having to move my application from the teensy 3.2 to 4.0. I'm getting this error when I use either INTERNAL or DEFAULT in the analogReference statement on the teensy 4.0,

Arduino\ADC_test_teensy_4.0\ADC_test_teensy_4.0.ino:6:19: error: 'INTERNAL' was not declared in this scope analogReference(INTERNAL); This is a simple application to read a battery voltage, scaled to stay below 3.3V.

What do I need to change to get this to compile on a teensy 4.0?


Code:
  /*******************************************************************************
            setup for low voltage detection
  ********************************************************************************/
  analogReference(INTERNAL);
  analogReadResolution(12);
  analogReadAveraging(32);
}

void loop() {

}
 
Comment out the offending line. According to analog.c,
Code:
void analogReference(uint8_t type)
{
}
analogReference() is a noop in teensy4
 
Thanks for the info. I'll get rid of it. I guess since the 4.0 is a 3.3V processor it will always use 3.3V as the reference.
 
Back
Top