#include "U8glib.h" #include "Arduino.h" #define sensorPin 0 #define DELAY 10 const int cycles = 20; U8GLIB_LC7981_240X128 u8g(4, 5, 6, 7, 0, 1, 2, 3, 8, 9, 10, 11, 12); // 8Bit Com: D0..D7: 4,5,6,7,0,1,2,3 en=8, cs=9 ,di=10,rw=11, reset = 12 void setup(void) { } void u8g_prepare(void) { // u8g.setFont(u8g_font_profont12); // u8g.setFont(u8g_font_7x13B); u8g.setFont(u8g_font_osb21); // u8g.setFont(u8g_font_helvB10); // u8g.setFontRefHeightExtendedText(); // u8g.setDefaultForegroundColor(); // u8g.setFontPosTop(); } void draw(void) { // graphic commands to redraw the complete screen should be placed here u8g_prepare(); u8g.drawFrame(4,0,230,27); //zeichnet von x0,y0 nach x1,y1 einen Rahmen u8g.drawStr(10, 24, "Der Test "); } void loop(void) { // picture loop u8g.firstPage(); do { draw(); } while( u8g.nextPage() ); float resultTemp = 0.0; for(int i = 0; i < cycles; i++){ int analogValue = analogRead(sensorPin); float temperature = (5.0 * 100.0 * analogValue) / 1024; resultTemp += temperature; delay(DELAY); resultTemp /= cycles; } }