Cintillo Institucional
Diferencias entre las revisiones 26 y 27
Versión 26 con fecha 2009-05-25 08:05:30
Tamaño: 2373
Comentario:
Versión 27 con fecha 2009-05-25 08:05:48
Tamaño: 2366
Comentario:
Los textos eliminados se marcan así. Los textos añadidos se marcan así.
Línea 33: Línea 33:
=== ===

wiki comunidad

Proyecto Hardware Libre Cenditel

Página Cenditel

wiki Cenditel

Plataforma de Desarrollo Colaborativo

Curso Sensibilización Hardware Libre (Unidad 002)

logohl.png logohl.png logohl.png

002/02 Actividad 002

Descripción de las entradas

  • * Se cuenta con 6 entradas, contienen un convertidor A/D de 10 bits.
  • * 0-5v se transforma en 0-1023

Comandos

analogRead(potPin)

analog01.jpg

figura 22.1:

  • analog03.jpg

figura 22.2

analog02.jpg

figura 22.3

/*
 * AnalogInput
 * by DojoDave <http://www.0j0.org>
 *
 * Turns on and off a light emitting diode(LED) connected to digital
 * pin 13. The amount of time the LED will be on and off depends on
 * the value obtained by analogRead(). In the easiest case we connect
 * a potentiometer to analog pin 2.
 *
 * http://www.arduino.cc/en/Tutorial/AnalogInput
 */

int potPin = 2;    // select the input pin for the potentiometer
int ledPin = 13;   // select the pin for the LED
int val = 0;       // variable to store the value coming from the sensor

void setup() {
  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT
}

void loop() {
  val = analogRead(potPin);    // read the value from the sensor
  digitalWrite(ledPin, HIGH);  // turn the ledPin on
  delay(val);                  // stop the program for some time
  digitalWrite(ledPin, LOW);   // turn the ledPin off
  delay(val);                  // stop the program for some time
}

hlpd/curso_arduino/uni00202 (última edición 2011-07-15 16:43:51 efectuada por _desactivada_csoto)