Difference between revisions of "A Tarduino example done properly"

From The TinkerNet Wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
  #include <Arduino.h>  // Pretty much only here to giv us Serial Communications & delay()
 
  #include <Arduino.h>  // Pretty much only here to giv us Serial Communications & delay()
 
   
 
   
  #include "FooBar.h"
+
  #include "FooBar.h"   // This header file lives in the src directory
 
   
 
   
 
  void setup() {
 
  void setup() {

Revision as of 00:33, 8 December 2020

main.cpp

#include <Arduino.h>  // Pretty much only here to giv us Serial Communications & delay()

#include "FooBar.h"   // This header file lives in the src directory

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Howdee!");
  delay(10000);   // What a silly way to rape a microcontroller...
}

void loop() {
  // put your main code here, to run repeatedly:
  Function1();
}

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