Indicador de luz

3 views
Skip to first unread message

Fernando F. Gallego

unread,
Sep 9, 2011, 8:07:51 AM9/9/11
to arduino...@googlegroups.com
Buenas,

el proyecto era hacer un termómetro con un servo y el sensor de temperatura pero como mi kit no traía ese sensor, lo he hecho con un sensor de luz. También he hecho un vídeo


El código:

#include <Servo.h>

Servo s;

void setup() {
  // put your setup code here, to run once:
  //pinMode(9,OUTPUT);
  pinMode(A0, INPUT);
  Serial.begin(9600);
  s.attach(9);
}

void loop() {
   float l = analogRead(A0);
   Serial.print(l);
   Serial.print(" ");
   int v = map(l,0,1024,0,179);
   s.write(v);
   Serial.println(v);
  
}

--
--

Syvic

unread,
Sep 27, 2011, 1:03:59 PM9/27/11
to arduino...@googlegroups.com
Está genial, es justo lo que quería. ¿Alguien más ha podido hacerlo?

Ciao!

Jorge
Reply all
Reply to author
Forward
0 new messages