arduino-esp32/libraries/OpenThread/examples/SimpleNode/SimpleNode.ino
Rodrigo Garcia d891ddfec7
New OpenThread CLI Arduino Library for ESP32-C6 and ESP32-H2 (#9908)
* feat(OThread): Add Library

* fix(OpenThread): fixes file list in CMakeLists.txt

* fix(openthread): Fixes JSON CI Files

* fix(openthread): Fixes JSON CI Files

* fix(openthread): Include Openthread guarding

* fix(openthread): COAP parametrization

* fix(openthread): Include Openthread guarding

* fix(openthread): Improves commentaries and code

* fix(openthread): Improves code

* fix(openthread): Includes StreamString.h

* feat(openthread): New Scan Example

* feat(openthread): Improved Scan Example

* feat(openthread): README.md

Initial documentation for ESP3 Arduino OpenThread CLI API.

* feat(openthread): helper functions documentation

Create helper_functions.md for ESP32 Arduino OpenThread API

* fix(openthread): begin end

* feat(openthread): onReceice example

* fix(openthread): tx queue error

* fix(doc): fixing documentation apresentation

Fixes the documentation first paragraph in order to make it easier fore reading. It also displays in the very top which SoC are supported by the library.

* fix(doc): documentation format

* feat(openthread): commentary

* fix(openthread): Typo, start/stop console

* fix(openthread): library properties

* ci(pre-commit): Apply automatic fixes

* feat(openthread): formatting text

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-06-24 19:26:42 +03:00

32 lines
965 B
C++

/*
* OpenThread.begin() will automatically start a node in a Thread Network
* If NVS is empty, default configuration will be as follow:
*
* NETWORK_NAME "OpenThread-ESP"
* MESH_LOCAL_PREFIX "fd00:db8:a0:0::/64"
* NETWORK_CHANNEL 15
* NETWORK_PANID 0x1234
* NETWORK_EXTPANID "dead00beef00cafe"
* NETWORK_KEY "00112233445566778899aabbccddeeff"
* NETWORK_PSKC "104810e2315100afd6bc9215a6bfac53"
*
* If NVS has already a dataset information, it will load it from there.
*/
#include "OThreadCLI.h"
#include "OThreadCLI_Util.h"
// The first device to start Thread will be the Leader
// Next devices will be Router or Child
void setup() {
Serial.begin(115200);
OThreadCLI.begin(); // AutoStart using Thread default settings
otPrintNetworkInformation(Serial); // Print Current Thread Network Information
}
void loop() {
Serial.print("Thread Node State: ");
Serial.println(otGetStringDeviceRole());
delay(5000);
}