5 years, 10 months ago.

ADC Issues with Seeeduino Arch Pro LPC1768

Hey,

Crazy things are happening. My goal is to use the mbed libraries on my local machine to do stuff for the Seeeduino Arch Pro. I exported the blinky program and compiled, uploaded it with PyOCD and the LED blinked as expected (although it was active low, meh). Then, I implemented some code to use the ADC and...well...it doesn't really work as expected. So just for kicks, I compiled the same code in the online compiler and it worked magically. This leads me to believe that the compiler version that I'm using is wrong.

I'm using gcc-arm-none-eabi-7-2017-q4-major-mac

Any help is appreciated.

main

// please excuse my egrigious formatting

#include "mbed.h"

DigitalOut myled(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);

AnalogIn adc(P0_26);
Serial serial(P0_0, P0_1, 19200);

int main() {
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
        
        serial.printf("%5d\n\r", adc.read_u16()); // I used an FTDI -> USB cable and `screen` to see what the ADC value was
        if(adc.read_u16() > (0xFFFF / 2))
           {
              led2 = 1;
              led3 = 0;
           }
           else
           {
              led2 = 0;
              led3 = 1;
           }
    }
}

1 Answer

5 years, 10 months ago.

Hi Gabriel,

Are you using the Mbed CLI to compile your programs locally?

I am also on a Mac with GCC version gcc-arm-none-eabi-7-2017-q4-major

- Jenny, team Mbed

Hi @Jenny

I am not, just using plain ol' `make`. I put the paths to the toolchains into the mbed generated makefile so it could be found.

I'll give the CLI a shot.

posted by Gabriel Velasco 15 Jun 2018