Hardware Reference
In-Depth Information
3. Connect your computer to Galileo via the USB client port.
4. Create a new sketch within the Arduino IDE and enter in the code from
Example 6-2 .
5. Upload the code to the Galileo.
6. Open the serial monitor.
Example 6-2. Using a system call to see output of
ifconfig
void setup () {
Serial . begin ( 9600 );
}
void loop () {
system ( "ifconfig &> /dev/ttyGS0" ); //
delay ( 3000 );
}
Execute the command ifconfig and output the results to the serial
monitor.
If you see text like the text below in the serial monitor, you'll know you have
it working correctly (if you're connected with WiFi, the wlan0 adapter will ap-
pear in the list, too).
eth0 Link encap:Ethernet HWaddr 00:13:20:FD:F6:5D
inet addr:10.0.1.119 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::213:20ff:fefd:f65d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2625 errors:0 dropped:0 overruns:0 frame:0
TX packets:877 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:632810 (617.9 KiB) TX bytes:143590 (140.2 KiB)
Interrupt:41 Base address:0x4000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
The preceding example lists two network devices: the first, eth0 , represents
the Ethernet connection to the router. The second, lo , is a local loopback . It's
a virtual network device for testing and enables programs running on your
device to connect to local services (or daemons ) even if there's no Ethernet
or WiFi connection.
Search WWH ::




Custom Search