Created
December 7, 2016 03:19
-
-
Save brian-lc/fd5deff85023a5c750ccdb26b55e62ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the STARTUP() macro to set the default antenna | |
STARTUP(WiFi.selectAntenna(ANT_EXTERNAL); // selects the u.FL antenna | |
void setup() | |
{ | |
Serial.begin(9600); | |
} | |
void loop(){ | |
} | |
// Callback when there is data on the Serial1 line | |
void serialEvent1() | |
{ | |
char c = Serial.read(); | |
//write to buffer | |
} | |
void deliverPayload(){ | |
WiFi.on(); | |
wifiReadyWait(); | |
packageDataBuffer(); | |
sendToServer(); | |
WiFi.off(); | |
} | |
void packageDataBuffer(){ | |
// Collect from data buffer | |
// Building the payload | |
// Put in outbound buffer | |
} | |
void sendToServer(){ | |
// Stream the outbound buffer to the internet | |
// collect response and response payload | |
} | |
// A simple delay to wait for wifi to be ready | |
// Should have an IP and be able to connect | |
// to the network when this returns | |
// TODO: Move to timer based callback | |
void wifiReadyWait(){ | |
while (WiFi.ready() == false){ | |
delay(10); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment