document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // Testprogramm für Helligkeitssensor
  2.  
  3. #include "qfixSoccerBoard.h"
  4. #include "LCD.h"
  5. #include "qfixI2C.h"
  6. #include "qfixI2CDefs.h"
  7.  
  8. SoccerBoard robot;
  9.  
  10. LCD lcd;           // you can use this constructor if the ID is 0
  11. //LCD lcd();       // use this if the ID is not 0. replace 1 by the ID
  12.   I2C i2c;
  13.  
  14. int main()
  15. {
  16. lcd.init();
  17. lcd.clear();
  18.  
  19. lcd.print("Helligkeitswerte anzeigen");
  20. lcd.cursorhome();
  21. msleep(5000);
  22. lcd.clear();
  23. robot.powerOn(3); // Analog An3 bekommt 5 V!
  24. int Helligkeit = 0;
  25.  
  26.  
  27. while(true)
  28.    
  29.     {  
  30.     lcd.cursorhome();
  31.     lcd.clear();
  32.         lcd.print("Helligkeit: ");
  33.     Helligkeit = robot.analog(3); // Einlesen des Analog-Messwertes
  34.         lcd.print_integer(Helligkeit);
  35.     msleep(1000); // jede Sekunde Helligkeit anzeigen
  36.     }
  37. }
');