Skip to content

Commit c212c9d

Browse files
committed
Added WiFiCheck example to Bridge Library
1 parent 6e94316 commit c212c9d

File tree

1 file changed

+53
-0
lines changed
  • hardware/arduino/avr/libraries/Bridge/examples/WiFiCheck

1 file changed

+53
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
Arduino Yun Wireless Config Check
3+
4+
Checks the wireless state of Arduino Yun by calling
5+
the linux command iwconfig.
6+
7+
Upload this to an Arduino Yun via serial (not WiFi)
8+
then open the serial monitor to see the status of
9+
your Yun's WiFi connection. If it's connected to
10+
a wireless network, the ESSID (name) of that network
11+
and the signal strength will appear.
12+
13+
The circuit:
14+
* Arduino Yun
15+
16+
created 22 May 2013
17+
by Tom Igoe
18+
19+
This example code is in the public domain.
20+
*/
21+
22+
#include <Process.h>
23+
24+
void setup() {
25+
Serial.begin(9600); // initialize serial communication
26+
while(!Serial); // do nothing until the serial monitor is opened
27+
28+
pinMode(13,OUTPUT);
29+
digitalWrite(13, LOW);
30+
Bridge.begin(); // make contact with the linux processor
31+
digitalWrite(13, HIGH);
32+
33+
delay(2000); // wait 2 seconds
34+
35+
Process wifiCheck; // initialize a new process
36+
37+
38+
wifiCheck.begin("iwconfig"); // command you want to run
39+
wifiCheck.addParameter("wlan0"); // parameter of the command
40+
wifiCheck.run(); // run the command
41+
42+
// while there's any characters coming back from the
43+
// process, print them to the serial monitor:
44+
while (wifiCheck.available() > 0) {
45+
char thisChar = wifiCheck.read();
46+
Serial.print(thisChar);
47+
}
48+
}
49+
50+
void loop() {
51+
// nothing to do here.
52+
}
53+

0 commit comments

Comments
 (0)