tilt.ino 467 B

123456789101112131415161718192021222324252627282930
  1. #include <EEPROM.h> //' A{
  2. #include <SPI.h>
  3. #include <GD2.h>
  4. void setup()
  5. {
  6. Serial.begin(1000000); // JCB
  7. GD.begin();
  8. }
  9. void loop()
  10. {
  11. GD.get_inputs();
  12. int x, y, z;
  13. GD.get_accel(x, y, z);
  14. GD.Clear();
  15. GD.LineWidth(16 * 3);
  16. int xp = 240 + x;
  17. int yp = 136 + y;
  18. GD.Begin(LINES);
  19. GD.Vertex2f(16 * 240, 16 * 136);
  20. GD.Vertex2f(16 * xp, 16 * yp);
  21. GD.PointSize(16 * 40);
  22. GD.Begin(POINTS);
  23. GD.Vertex2f(16 * xp, 16 * yp);
  24. GD.swap();
  25. } //' }A