<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Flight Simulator 101 or back to college - part 14: Programming Arduino like an adult! Kill the loop()!</title><link>/members-area/personalblogs/b/nexgen-flight-simuator/posts/flight-simulator-101-or-back-to-college---part-14-programming-arduino-like-an-adult-kill-the-loop</link><description>Why did I say &amp;quot;Programming Arduino like an adult! Kill the loop()!&amp;quot;? First, we need to know where this construct came from. A sketch is a variant of the C++ programming language. Hell, wait doesn&amp;#39;t C++ have a main() function? Yep, it surel...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Flight Simulator 101 or back to college - part 14: Programming Arduino like an adult! Kill the loop()!</title><link>https://community.element14.com/members-area/personalblogs/b/nexgen-flight-simuator/posts/flight-simulator-101-or-back-to-college---part-14-programming-arduino-like-an-adult-kill-the-loop</link><pubDate>Mon, 10 Apr 2023 01:10:25 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:5e55a0df-5e23-4770-a925-4cd51a853748</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Chris, in Arduino, everything is a class. Each Arduino library is a c++ class.&lt;/p&gt;
&lt;p&gt;The part about loop(), main() and macros is wrong. The Arduino libraries implement main(). And in that main(), they first call setup() once, then continuously loop(). .&lt;/p&gt;
&lt;p&gt;&lt;a id="" href="https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/main.cpp"&gt;https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/main.cpp&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;int main(void)&lt;br /&gt;{&lt;br /&gt; init();&lt;br /&gt;&lt;br /&gt; initVariant();&lt;br /&gt;&lt;br /&gt;#if defined(USBCON)&lt;br /&gt; USBDevice.attach();&lt;br /&gt;#endif&lt;br /&gt; &lt;br /&gt; setup();&lt;br /&gt; &lt;br /&gt; for (;;) {&lt;br /&gt; loop();&lt;br /&gt; if (serialEventRun) serialEventRun();&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; return 0;&lt;br /&gt;}&lt;/pre&gt;&lt;img src="https://community.element14.com/aggbug?PostID=25634&amp;AppID=300&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>