Using an Arduino library with other microcontrollers

Thread Starter

guetkar

Joined Mar 9, 2022
43
Hi,

Does any one know if we can use an arduino library with another chip (pic, or stm32 ...).

Is there a way to adapt it and reuse on a non arduino system, just by using the .cpp and .h files.

Thanks.

Karim
 

AlbertHall

Joined Jun 4, 2014
12,269
Welcome to AAC, @guetkar
In general, yes, this is possible. You will probably need to understand the code and what it is doing to adapt it to a different processor. I have done this.
 

click_here

Joined Sep 22, 2020
548
It's got to do with how portable the code in the library is, and whether it uses classes which are not supported by C

I have taken code from Arduino libraries for PICs before - I've also just opened and read the code to debug problems with my code when it came to interfacing with other devices.

As @AlbertHall alluded to - You need to understand the code and what it is doing

Hope that helps :)
 
Top