document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. //Mateo Aya
  2. #include <Servo.h>
  3. #include <LiquidCrystal.h>
  4. int infotocelda = A1;
  5. int valorfotocelda = 0;
  6. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  7. Servo servo;
  8. void setup()
  9. {
  10.   lcd.begin(16, 2);
  11.   lcd.print("FOTOCELDA:");
  12.   Serial.begin(9600);
  13.   servo.attach(7);
  14. }
  15. void loop()
  16. {
  17.   lcd.setCursor(0,11);
  18.   infotocelda = analogRead(A1);
  19.   Serial.println(infotocelda,DEC);
  20.   valorfotocelda = map(infotocelda,300,870,0,180);
  21.   servo.write(valorfotocelda);
  22.   lcd.print(valorfotocelda); lcd.print(" ");
  23. }
');