Advertisement
heidepower

Untitled

May 24th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1.  
  2. #include <SPI.h>
  3. #include <Wire.h>
  4. #include <Adafruit_GFX.h>
  5. #include <Adafruit_SSD1306.h>
  6.  
  7. #define OLED_RESET 4
  8.  
  9. Adafruit_SSD1306 display(OLED_RESET);
  10.  
  11. int potValue=0;
  12. int potValue1=0;
  13. int online = 0;
  14. float systemdruck = 0.00;
  15. int zz = 0;
  16. int xx = 10;
  17.  
  18. int x0;
  19. int y0;
  20.  
  21.  
  22.  
  23. void setup()
  24. {
  25. Serial.begin(9600);
  26. display.begin(SSD1306_SWITCHCAPVCC);
  27. display.setTextColor(WHITE);
  28. display.clearDisplay();
  29.  
  30. }
  31.  
  32. void loop()
  33. {
  34.  
  35.  
  36. potValue = analogRead(A0);
  37.  
  38. //xy Achsen
  39. display.drawLine(0, 0, 0, 31, WHITE);
  40. display.drawLine(0, 31, 127, 31, WHITE);
  41.  
  42. potValue1 = map(potValue, 0, 1023, 0, 31); // analog Eingang auslesen und auf LCDhöhe angepasst
  43.  
  44. //Kurve zeichnen
  45. display.drawPixel(x0, potValue1, WHITE);
  46. if (x0 <127)
  47. {
  48. x0++;
  49. }
  50. if ( x0 == 127)
  51. {
  52. x0=127;
  53. }
  54.  
  55.  
  56. display.display();
  57.  
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement