Arduino-due undefined reference

Dear RIOT user mailing list,

So i was trying to create a simple program using RIOT in my arduino-due to read a Soil moisture sensor but as i try to run the program i found this error

/home/afif/RIOT/Script/Soil/bin/arduino-due/arduino.a(base.o): In function `analogRead(int)': /home/afif/RIOT/sys/arduino/base.cpp:91: undefined reference to `adc_init' /home/afif/RIOT/sys/arduino/base.cpp:99: undefined reference to `adc_sample' collect2: error: ld returned 1 exit status /home/afif/RIOT/Makefile.include:454: recipe for target '/home/afif/RIOT/Script/Soil/bin/arduino-due/Script_Soil.elf' failed make: *** [/home/afif/RIOT/Script/Soil/bin/arduino-due/Script_Soil.elf] Error 1

I have checked the base.cpp file but can't seem to find where the adc_init or adc_sample is initiated from. Can anyone help me fix this problem? thank you very much

With utmost respect,

Afif Aziz

Hi Afif,

adc_init and adc_sample are functions of the RIOT peripheral API [1] and they are implemented by each platform (that has an ADC). Personally, I'd always recommend to use these directly (see [2] for an example).

However, if you really want to use the Arduino API I'd suggest, as a first step, add the analorRead calls to examples/arduino_hello-world and see if this works for arduino-due.

Best Peter

[1] [2] [3]