Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions examples/startHere/startHere.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
//************************************************************
#include <easyMesh.h>

#include <Ticker.h>
// some gpio pin that is connected to an LED...
// on my rig, this is 5, change to the right number of your LED.
#define LED 5 // GPIO number of connected LED
Expand All @@ -22,12 +22,18 @@
#define MESH_PORT 5555

easyMesh mesh;
Ticker meshUpdateTimer;

uint32_t sendMessageTime = 0;

void meshUpdate(){
mesh.update(); //update mesh parameters
}

void setup() {
Serial.begin(115200);

//call meshUpdate function every 3 sec
meshUpdateTimer.attach(3,meshUpdate); //delay depends on how frequently nodes are moving
pinMode( LED, OUTPUT );

//mesh.setDebugMsgTypes( ERROR | MESH_STATUS | CONNECTION | SYNC | COMMUNICATION | GENERAL | MSG_TYPES | REMOTE ); // all types on
Expand All @@ -41,8 +47,6 @@ void setup() {
}

void loop() {
mesh.update();

// run the blinky
bool onFlag = false;
uint32_t cycleTime = mesh.getNodeTime() % BLINK_PERIOD;
Expand Down Expand Up @@ -75,4 +79,3 @@ void receivedCallback( uint32_t from, String &msg ) {
void newConnectionCallback( bool adopt ) {
Serial.printf("startHere: New Connection, adopt=%d\n", adopt);
}