Difference between revisions of "A Tarduino example done properly"

From The TinkerNet Wiki
Jump to navigation Jump to search
Line 20: Line 20:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
  
 
=FooBar.h=
 
=FooBar.h=

Revision as of 00:57, 8 December 2020

main.cpp

 1 #include <Arduino.h>  // Pretty much only here to giv us Serial Communications & delay()
 2 
 3 #include "FooBar.h"   // This header file lives in the src directory
 4 
 5 void setup() {
 6   // put your setup code here, to run once:
 7   Serial.begin(115200);
 8   Serial.println("Howdee!");
 9   delay(10000);   // What a silly way to rape a microcontroller...
10 }
11 
12 void loop() {
13   // put your main code here, to run repeatedly:
14   Function1();
15   delay(1000);   // UGH...
16   Function2();
17   delay(1000);   // UGH...
18 }

FooBar.h

void Function1();

Function1.cpp

#include <Arduino.h>

void Function1()
{
    Serial.println("Hi Grant!");
    delay(1000);   // What a silly way to rape a microcontroller...
}

platformio.ini

(Coz I have this preference in IDEs...)

[env:esp07]
platform = espressif8266
board = esp07
framework = arduino