Difference between revisions of "Arduino with linux"
(hooking up the Arduino with usb under linux) |
(output also) |
||
Line 15: | Line 15: | ||
This is a normal character device and you can send text to it or read from it very simply. | This is a normal character device and you can send text to it or read from it very simply. | ||
echo foo > /dev/ttyUSB0 | echo foo > /dev/ttyUSB0 | ||
− | The text ''foo'' is written to the Arduino over the serial usb line. You should see the small orange | + | The text ''foo'' is written to the Arduino over the serial usb line. You should see the small orange LED flicker as the data is recieved by the Arduino. Of course data can be sent in both directions. If you want to read from the Arduino you can do: |
+ | tail -f /dev/ttyUSB0 | ||
+ | In order for anything to happen, the Arduino must have some kind of program that sends output, otherwise you will see no result. | ||
+ | |||
[[Category:Hardware]] | [[Category:Hardware]] |
Revision as of 07:40, 22 September 2008
Arduino is a small computer that connects to the pc with usb. Under debian with a 2.6.18-6-686 kernel it is detected automatically by the usbcore driver. Make sure the link on the Arduino is set to usb power and plug it into the powered on pc. The green LED on the Arduino should light.
Type
dmesg
and you should see some messages like this at the end of the output.
usb 1-2: new full speed USB device using uhci_hcd and address 4 usb 1-2: configuration #1 chosen from 1 choice ftdi_sio 1-2:1.0: FTDI USB Serial Device converter detected drivers/usb/serial/ftdi_sio.c: Detected FT232BM usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0
This means the Arduino has been detected. There will now be a device in /dev called ttyUSB0 or similar.
ls /dev/ttyUSB*
This is a normal character device and you can send text to it or read from it very simply.
echo foo > /dev/ttyUSB0
The text foo is written to the Arduino over the serial usb line. You should see the small orange LED flicker as the data is recieved by the Arduino. Of course data can be sent in both directions. If you want to read from the Arduino you can do:
tail -f /dev/ttyUSB0
In order for anything to happen, the Arduino must have some kind of program that sends output, otherwise you will see no result.