Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7db18ed

Browse files
add TheUltimateGuideToWifiIndoorPositioningExample
1 parent 794c0f9 commit 7db18ed

File tree

5 files changed

+91
-3
lines changed

5 files changed

+91
-3
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include <WiFi.h>
2+
3+
#define print(string) Serial.print(string);
4+
#define quote(string) print('"'); print(string); print('"');
5+
6+
7+
String location = "";
8+
9+
10+
/**
11+
*
12+
*/
13+
void setup() {
14+
Serial.begin(115200);
15+
delay(3000);
16+
WiFi.disconnect();
17+
print("Enter 'scan {location}' to start the scanning and 'stop' to stop scanning\n");
18+
}
19+
20+
/**
21+
*
22+
*/
23+
void loop() {
24+
// look for new command
25+
if (Serial.available()) {
26+
String input = Serial.readStringUntil('\n');
27+
28+
if (input.indexOf("scan ") == 0) {
29+
location = input.substring(5);
30+
print("Started scanning...");
31+
print(location);
32+
print("\n");
33+
}
34+
else {
35+
print("Command not found. Enter 'scan {location}' to start the scanning\n");
36+
location = "";
37+
}
38+
}
39+
40+
// if location is set, scan networks
41+
if (location != "") {
42+
int numNetworks = WiFi.scanNetworks();
43+
44+
// print location
45+
print('{');
46+
quote("__location");
47+
print(": ");
48+
quote(location);
49+
print(", ");
50+
51+
// print each network SSID and RSSI
52+
for (int i = 0; i < numNetworks; i++) {
53+
quote(WiFi.SSID(i));
54+
print(": ");
55+
print(WiFi.RSSI(i));
56+
print(i == numNetworks - 1 ? "}\n" : ", ");
57+
}
58+
59+
delay(1000);
60+
}
61+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <WiFi.h>
2+
#include "Converter.h"
3+
#include "Classifier.h"
4+
5+
6+
Eloquent::Projects::WifiIndoorPositioning positioning;
7+
Eloquent::ML::Port::DecisionTree classifier;
8+
9+
10+
void setup() {
11+
Serial.begin(115200);
12+
WiFi.disconnect();
13+
}
14+
15+
16+
void loop() {
17+
positioning.scan();
18+
Serial.print("You're in ");
19+
Serial.println(classifier.predictLabel(positioning.features));
20+
delay(3000);
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Upload this first and record the features
2+
#include "CollectData.h"
3+
4+
// Then generate the "Converter.h" and "Classifier.h" content with micromlgen
5+
// and upload the following
6+
//#include "GetPosition.h"

‎library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "git",
77
"url": "https://github.com/eloquentarduino/EloquentArduino"
88
},
9-
"version": "1.1.11",
9+
"version": "1.1.12",
1010
"authors": {
1111
"name": "Simone Salerno",
1212
"url": "https://github.com/eloquentarduino"

‎library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name=EloquentArduino
2-
version=1.1.11
2+
version=1.1.12
33
author=Simone Salerno <eloquentarduino@gmail.com>
44
maintainer=Simone Salerno <eloquentarduino@gmail.com>
55
sentence=An eloquent interface to common Arduino patterns, data structures and algorithms
66
paragraph=Follow the blog at eloquentarduino.github.io for details
77
category=Other
88
url=https://github.com/eloquentarduino/EloquentArduino
99
architectures=*
10-
includes=eloquentarduino.h
10+
includes=eloquentarduino.h

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /