source: rtos_arduino/trunk/arduino_lib/libraries/Bridge/examples/WiFiStatus/WiFiStatus.ino@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 1.3 KB
Line 
1/*
2 WiFi Status
3
4 This sketch runs a script called "pretty-wifi-info.lua"
5 installed on your Y炭n in folder /usr/bin.
6 It prints information about the status of your wifi connection.
7
8 It uses Serial to print, so you need to connect your Y炭n to your
9 computer using a USB cable and select the appropriate port from
10 the Port menu
11
12 created 18 June 2013
13 By Federico Fissore
14
15 This example code is in the public domain.
16
17 http://arduino.cc/en/Tutorial/YunWiFiStatus
18
19 */
20
21#include <Process.h>
22
23void setup() {
24 Serial.begin(9600); // initialize serial communication
25 while (!Serial); // do nothing until the serial monitor is opened
26
27 Serial.println("Starting bridge...\n");
28 pinMode(13, OUTPUT);
29 digitalWrite(13, LOW);
30 Bridge.begin(); // make contact with the linux processor
31 digitalWrite(13, HIGH); // Led on pin 13 turns on when the bridge is ready
32
33 delay(2000); // wait 2 seconds
34}
35
36void loop() {
37 Process wifiCheck; // initialize a new process
38
39 wifiCheck.runShellCommand("/usr/bin/pretty-wifi-info.lua"); // command you want to run
40
41 // while there's any characters coming back from the
42 // process, print them to the serial monitor:
43 while (wifiCheck.available() > 0) {
44 char c = wifiCheck.read();
45 Serial.print(c);
46 }
47
48 Serial.println();
49
50 delay(5000);
51}
52
Note: See TracBrowser for help on using the repository browser.