Created
November 15, 2016 02:21
-
-
Save technobly/2deb51da9134d46c571a5de7915547bd to your computer and use it in GitHub Desktop.
Wi-Fi RSSI test app
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
#define DEBUG_SERIAL true | |
#define MEASUREMENT_INTERVAL 10000 | |
uint32_t lastTime = 0; | |
int i = 0; | |
void setup() { | |
if (DEBUG_SERIAL) Serial.begin(9600); | |
} | |
void loop() { | |
if (millis() - lastTime > MEASUREMENT_INTERVAL) { | |
lastTime = millis(); | |
int measurement = WiFi.RSSI(); | |
String SSID = WiFi.SSID(); | |
bool connected = Particle.connected(); | |
if (connected) { | |
Particle.publish("myRSSItest", String("SSID:")+SSID+String(",RSSI:")+String(measurement)); | |
} | |
if (DEBUG_SERIAL) { | |
Serial.printlnf("%d %s %s %d", ++i, connected?"true":"false", SSID.c_str(), measurement); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment