[riot-users] Arduino-due undefined reference

Peter Kietzmann peter.kietzmann at haw-hamburg.de
Wed Jul 17 11:13:56 CEST 2019

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.


[1] https://riot-os.org/api/group__drivers__periph__adc.html
[2] https://github.com/RIOT-OS/RIOT/tree/master/tests/periph_adc
[3] https://github.com/RIOT-OS/RIOT/tree/master/examples/arduino_hello-world

Am 06.05.19 um 08:02 schrieb afif.abdul51:
> 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
> _______________________________________________
> users mailing list
> users at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/users

Peter Kietzmann

Hamburg University of Applied Sciences
Dept. Informatik, Internet Technologies Group
Berliner Tor 7, 20099 Hamburg, Germany
Fon: +49-40-42875-8426
Web: http://www.haw-hamburg.de/inet

More information about the users mailing list