Skip to content

Instantly share code, notes, and snippets.

@technobly
Created November 15, 2016 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technobly/2deb51da9134d46c571a5de7915547bd to your computer and use it in GitHub Desktop.
Save technobly/2deb51da9134d46c571a5de7915547bd to your computer and use it in GitHub Desktop.
Wi-Fi RSSI test app
#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