0
I'm programming in my Arduino board and as i see, commands in those tutorials are diffrent..
What is difrense betwen those codes? I mean they both use c++! I havent seen void loop in tutorial. Luka
3 odpowiedzi
+ 2
Arduino uses Arduino.h as default. Even if you don't have to write it, actually Setup and loop are enclosed within a normal
int main(){
your sketch comes here.
return 0;
}
some of the arduino dedicated functions (pin handling) are just an abstraction layer that takes care of the more complex stuff that you should otherwise code in c/AVR assembler.
+ 1
most of the code in an arduino is straight c not c++ only some c++ stuff works. The reason the code is different is cause it's run on a loop and mostly used as a state machine where typical c is top down execution unless your doing multi threading. For example you can be running multiple things at once on an arduino like checking several pins statuses and it won't change the code till the state changes. To do that in c you would need nested for loops mostly and a while true loop till a break condition for all of main.
0
arduino language is a customized version of both c and c++. codes in c and c++ have been tailored to fit arduino programming. c++ is a general language but once completed, a programmer can specialize in areas like ,microcontroller programming, network programming, as of the case of arduino- microcontroller..