For C programmers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

For C programmers

How to create class or library in C programming for Arduino

13th Mar 2021, 5:38 AM
Melekte Petros
Melekte Petros - avatar
3 Answers
+ 2
I'm not an Arduino Expert but after searching a bit on the web i found some articles that may help you in your journey. And before that, C doesn't support classes. 1 - https://www.circuitxcode.com/creating-arduino-class/ 2 - https://www.arduino.cc/en/Hacking/LibraryTutorial 3 - https://www.radishlogic.com/arduino/use-c-class-arduino-ide-without-creating-library/ If you're aiming to create classes then use C++.
13th Mar 2021, 8:17 PM
Carbon
Carbon - avatar
+ 1
Sorry but you can't create Class in C language. If you know C programming then it's very very easy for you to shift to C++ language. You can create classes, objects, and separate library in C++.
14th Mar 2021, 2:51 PM
Illa Bahadur Darlami Magar
Illa Bahadur Darlami Magar - avatar
+ 1
You can create structs with C but you will struggle with encapsulation.
15th Mar 2021, 4:46 AM
Sonic
Sonic - avatar