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://www.arduino.cc/en/Tutorial/YunWiFiStatus 18 19 */ 20 21#include <Process.h> 22 23void setup() { 24 SerialUSB.begin(9600); // initialize serial communication 25 while (!SerialUSB); // do nothing until the serial monitor is opened 26 27 SerialUSB.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 SerialUSB.print(c); 46 } 47 48 SerialUSB.println(); 49 50 delay(5000); 51} 52