EasyManuals Logo

Arduino uno User Manual

Arduino uno
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #276 background imageLoading...
Page #276 background image
maik> ruby analog_reader.rb /dev/tty.usbmodem24321
a0: 496
a0: 456
a0: 382
^Canalog_reader.rb:27:in `gets': Interrupt
from analog_reader.rb:27
Using Ruby to access an Arduino is a good choice because you can fully
concentrate on your application. All of the ugly details you have to deal with
in other programming languages are well hidden.
Python
Python is another dynamic programming language you can use to quickly
create Arduino clients. For programming a serial port, download and install
the pyserial library first.
5
There is a special installer for Windows, but usually
its sufficient to install it like this:
maik> python setup.py install
After youve installed pyserial, you can use it to create a client for our analog
reader sketch:
/SerialProgramming/Python/analog_reader.py
import sys
Line 1
import time
-
import serial
-
-
if len(sys.argv) != 2:
5
print "You have to pass the name of a serial port."
-
sys.exit(1)
-
-
serial_port = sys.argv[1]
-
arduino = serial.Serial(
10
serial_port,
-
9600,
-
serial.EIGHTBITS,
-
serial.PARITY_NONE,
-
serial.STOPBITS_ONE)
15
time.sleep(2)
-
while 1:
-
arduino.write("a0\n")
-
line = arduino.readline().rstrip()
-
print line
20
5.
http://sourceforge.net/projects/pyserial/files/
report erratum discuss
Serial Communication Using Various Languages 263
www.it-ebooks.info

Table of Contents

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino uno and is the answer not in the manual?

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals