1 / 52
文档名称:

Arduino Spooky Projects Class3.pdf

格式:pdf   页数:52
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

Arduino Spooky Projects Class3.pdf

上传人:kuo08091 2014/3/22 文件大小:0 KB

下载得到文件列表

Arduino Spooky Projects Class3.pdf

文档介绍

文档介绍:Spooky Projects
Introduction to Microcontrollers with Arduino
Class 3
21 Oct 2006 - machineproject - Tod E. Kurt
What’s For Today
• Controlling Arduino from puter
• Controlling puter from Arduino
• Servomotors
• R,G,B LED color mixing
Remove ProtoShield
First half of class, we don’t need it
And we want to observe the Arduino board
“Shields down, cap’n!”
Recap: Programming
pile
Reset Upload
Remember: always start from a known working system
Communicating
with Others
• Arduino can use same USB cable for
programming and to talk puters
• Talking to other devices uses the “Serial”
commands
• () – prepare to use serial
• () – send data puter
• () – read data puter
Can talk to not puters.
Most things plex than simple sensors/actuators speak serial.
Watch the TX/RX LEDS
• TX – sending to PC
• RX – receiving from PC
• Used when programming
municating
(and keep an eye
on that pesky
pin13 LED too)
Arduino Says “Hi”
“serial_hello_world”
• Send “Hello world!”
to puter
(and blink LED)
• Click on
“Serial Monitor”
to see output
• Watch TX LED
compared to pin13
LED
This sketch is located in the handout, but it’s pretty short.
Use on-board pin 13 LED, no need to wire anything up.
Telling Arduino What To Do
“serial_read_basic”
• You type “H”
– LED blinks
• In “Serial Monitor”
type “H”, press Send
• Watch pin 13 LED
This sketch is in “Examples/m/serial_read_basic”.
Notice how you might not always read something, thus the “-1” check.
Can modify it to print “hello world” after it receives something, but before it checks for ‘H’.
This way you can verify it’s actually receiving something.
munications
is just munications
• Psst, Arduino doesn’t really do USB
• It really is “serial”, like old RS-232 serial
• All microcontrollers can do serial
• Not many can do USB
• Serial is easy, USB is hard
serial terminal from the olde days
munications