Difference between revisions of "Esp32 - HelloWorld"
Jump to navigation
Jump to search
Line 13: | Line 13: | ||
<syntaxhighlight lang="c++" line> | <syntaxhighlight lang="c++" line> | ||
//----------------------------------------- | //----------------------------------------- | ||
// Application: | // Application: Esp32ArdHelloWorld | ||
// Version....: 01V01 | // Version....: 01V01 | ||
// DateTime...: | // DateTime...: 2110142050 | ||
// Author.....: OMdevelop | // Author.....: OMdevelop | ||
//----------------------------------------- | //----------------------------------------- | ||
Line 22: | Line 22: | ||
// Definition | // Definition | ||
//----------------------------------------- | //----------------------------------------- | ||
#define SerialTerminal Serial | |||
// | // | ||
const int | const int TIMESPAN_SERIALOUT = 1000; // [ms] | ||
// | // | ||
// | // | ||
Line 31: | Line 31: | ||
//----------------------------------------- | //----------------------------------------- | ||
void setup() | void setup() | ||
{ // Configuration | { // Configuration Serial | ||
SerialTerminal.begin(115200); | |||
delay(333); | |||
SerialTerminal.println(""); | |||
SerialTerminal.println("**********************"); | |||
SerialTerminal.println("* Esp32ArdHelloWorld *"); | |||
SerialTerminal.println("* Version: 01V01 *"); | |||
SerialTerminal.println("* Date...: 211014 *"); | |||
SerialTerminal.println("* Time...: 2054 *"); | |||
SerialTerminal.println("* Author.: OMdevelop *"); | |||
SerialTerminal.println("**********************"); | |||
} | } | ||
// | // | ||
Line 39: | Line 48: | ||
//----------------------------------------- | //----------------------------------------- | ||
void loop() | void loop() | ||
{ // | { // print all seconds "Hello World!" | ||
delay(TIMESPAN_SERIALOUT); | |||
delay( | SerialTerminal.println("Hello World!"); | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 21:11, 14 October 2021
WebSite: OH&SW || MediaWiki: - Software - Hardware - Elektronik - Mechanik - Anhang
Übersicht
- Einfaches Beispiel zur Programmierung und zum Test eines Esp32-MicroControllers.
- Typische Hardware: Esp32UnoBoard mit Serieller-Usb-Schnittstelle.
- Funktion: nach dem Reset schreibt der Esp32 alle 1000ms die Message "Hello World!" über die Serielle Schnittstelle. Der Benutzer empfängt diese Nachricht mit einem Terminal-Programm.
Vorgabe
- Im Arduino-Projekt Esp32 - HelloWorld enthält die System-Konstante TIMESPAN_SERIALOUT die Vorgabezeit der periodischen Seriellen Ausgabe.
Quelltext
//-----------------------------------------
// Application: Esp32ArdHelloWorld
// Version....: 01V01
// DateTime...: 2110142050
// Author.....: OMdevelop
//-----------------------------------------
//
//-----------------------------------------
// Definition
//-----------------------------------------
#define SerialTerminal Serial
//
const int TIMESPAN_SERIALOUT = 1000; // [ms]
//
//
//-----------------------------------------
// Main - Setup
//-----------------------------------------
void setup()
{ // Configuration Serial
SerialTerminal.begin(115200);
delay(333);
SerialTerminal.println("");
SerialTerminal.println("**********************");
SerialTerminal.println("* Esp32ArdHelloWorld *");
SerialTerminal.println("* Version: 01V01 *");
SerialTerminal.println("* Date...: 211014 *");
SerialTerminal.println("* Time...: 2054 *");
SerialTerminal.println("* Author.: OMdevelop *");
SerialTerminal.println("**********************");
}
//
//-----------------------------------------
// Main - Loop
//-----------------------------------------
void loop()
{ // print all seconds "Hello World!"
delay(TIMESPAN_SERIALOUT);
SerialTerminal.println("Hello World!");
}
Hardware
- Esp32UnoBoard, allgemein jedes Esp32Board mit Serieller USB-Schnittstelle
Software
Wahlweise
- ArduinoIDE (Compiler-Benutzeroberfläche (Homepage: Arduino))
- mit Terminal innerhalb der ArduinoIDE
oder
- VisualStudioCode (Compiler-Benutzeroberfläche (Homepage: VisualStudioCode))
- mit Terminal innerhalb der IDE von VSCode
oder einem aktiven Terminal eigener Wahl
- HTerm (Terminal IDE (Homepage: Der Hammer)).
Download
Datum | Uhrzeit | Projekt | Version | Download |
211014 | 2115 | ArduinoIDE(C-Code): Esp32ArdHelloWorld | 01V01 | 2110142054_Esp32ArdHelloWorld_01V01.zip |
21mmdd | hhmm | ArduinoIDE(Cpp-Code): Esp32ArdHelloWorld | 01V02 | 2110142054_Esp32ArdHelloWorld_01V02.zip |
21mmdd | hhmm | VSCode(C-Code): Esp32VscHelloWorld | 02V01 | 2110142054_Esp32VscHelloWorld_02V01.zip |
21mmdd | hhmm | VSCode(Cpp-Code): Esp32VscHelloWorld | 02V02 | 2110142054_Esp32VscHelloWorld_02V02.zip |
WebSite:OH&SW || MediaWiki - Software - Hardware - Elektronik - Mechanik - Anhang || Datenschutz - Impressum