7 years, 10 months ago.

Runtime Error for analog output on MAX32600MBED

Hello, we are experiencing a runtime error with our code running on the MAX32600MBED. All we are trying to do is increase the voltage of the analog pin, but after debugging, there seems to be something wrong when constructing the analog pin object. Here is the code below:

#include "mbed.h"
#include "Servo.h"

AnalogOut  aout(P2_5);
DigitalOut dout(LED1);
 
int main(void)
{
    dout = 1;
    while (1) {
        // change the voltage on the digital output pin by 0.1 * VCC
        //  and print what the measured voltage should be (assuming VCC = 3.3v)
        for (float i = 0.0f; i < 0.f; i += 0.1f) {
            aout = i;
            // turn on the led if the voltage is greater than 0.5f * VCC
            dout = (aout > 0.5f) ? 1 : 0;
            wait(1.0f);
        }
        dout = 0;
        wait(1.0f);
        dout = 1;
        wait(1.0f);
    }
}

Does there seem to be anything wrong with the way we constructed it? We suspect it is the pin output name.

Thanks!

1 Answer

7 years, 10 months ago.

Use <<code>> and <</code>> to make it readable.

However on this platform only OUT_A till OUT_D seem to be DAC pins. So not P2_5.

Accepted Answer