Arduino

Páginas: 19 (4689 palabras) Publicado: 6 de diciembre de 2012
Arduino Tutorials from www.arduino.cc

Table of Content
Reading a Potentiometer (analog input) ......................................................................... 2 Code .......................................................................................................................... 2 The "Hello World!" of PhysicalComputing................................................................... 4 Code .............................................................................................................................. 4 Blinking an LED without using the delay() function...................................................... 6 Code ................................................................................................................................ 6Pushbutton....................................................................................................................... 9 Switch ........................................................................................................................... 11 Circuit .................................................................................................................... 11 Code........................................................................................................................ 11 Interfacing a Joystick .................................................................................................... 13 Knock Sensor ................................................................................................................ 16 Representing the Knock inProcessing .................................................... 17 Memsic 2125 Accelerometer ........................................................................................ 19 PING range finder................................................................................................. 22 Play Melody.................................................................................................................. 24 Example 1: Play Melody .................................................................................. 24 Keyboard Serial ............................................................................................................ 29 LCD Display - 8 bits ..................................................................................................... 31Unipolar Stepper Motor ................................................................................................ 34 Example 1: Simple example .......................................................................... 34 Example 2: Stepper Unipolar Advanced.................................................. 35References............................................................................................................ 37

1

Reading a Potentiometer (analog input)
A potentiometer is a simple knob that provides a variable resistance, which we can read into the Arduino board as an analog value. In this example, that value controls the rate at which an LED blinks. We connect three wires to the Arduino board. The first goes to ground from one of the outer pins of the potentiometer.The second goes from 5 volts to the other outer pin of the potentiometer. The third goes from analog input 2 to the middle pin of the potentiometer. By turning the shaft of the potentiometer, we change the amount of resistence on either side of the wiper which is connected to the center pin of the potentiometer. This changes the relative "closeness" of that pin to 5 volts and ground, giving us adifferent analog input. When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and we read 0. When the shaft is turned all the way in the other direction, there are 5 volts going to the pin and we read 1023. In between, analogRead() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.

Code
/* Analog...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Arduino
  • Que es arduino
  • Arduinos
  • ARDUINO
  • Arduino
  • Arduino UNO
  • Arduino
  • arduino

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS