Created
February 28, 2016 18:43
-
-
Save michaelsarduino/88c5bfb1485e23a0bccd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <Wire.h> | |
#include <Adafruit_GFX.h> | |
#include <Adafruit_SSD1306.h> | |
#define OLED_RESET 4 | |
Adafruit_SSD1306 display(OLED_RESET); | |
#define NUMFLAKES 10 | |
#define XPOS 0 | |
#define YPOS 1 | |
#define DELTAY 2 | |
#define LOGO16_GLCD_HEIGHT 16 | |
#define LOGO16_GLCD_WIDTH 16 | |
static const unsigned char PROGMEM logo16_glcd_bmp[] = | |
{ B00000000, B11000000, | |
B00000001, B11000000, | |
B00000001, B11000000, | |
B00000011, B11100000, | |
B11110011, B11100000, | |
B11111110, B11111000, | |
B01111110, B11111111, | |
B00110011, B10011111, | |
B00011111, B11111100, | |
B00001101, B01110000, | |
B00011011, B10100000, | |
B00111111, B11100000, | |
B00111111, B11110000, | |
B01111100, B11110000, | |
B01110000, B01110000, | |
B00000000, B00110000 }; | |
#if (SSD1306_LCDHEIGHT != 64) | |
#error("Height incorrect, please fix Adafruit_SSD1306.h!"); | |
#endif | |
#include <dht11.h> | |
dht11 DHT11; | |
#define DHT11PIN 2 | |
float temp; | |
float vorherige; | |
void setup() | |
{ | |
Serial.begin(115200); | |
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); | |
display.clearDisplay(); | |
} | |
void loop() | |
{ | |
display.clearDisplay(); | |
int chk = DHT11.read(DHT11PIN); | |
vorherige = temp; | |
temp = DHT11.temperature; | |
display.setCursor(0,10); | |
display.setTextColor(WHITE); | |
display.setTextSize(2); | |
display.println(temp); | |
if(vorherige > temp) | |
{ | |
display.drawLine(80, 20, 80, 40, WHITE); | |
display.fillTriangle(70, 40, 90, 40, 80, 55, WHITE); | |
} | |
if(vorherige == temp) | |
{ | |
display.drawLine(80, 30, 105, 30, WHITE); | |
display.fillTriangle(105, 40, 105, 20, 120, 30, WHITE); | |
} | |
if(vorherige < temp) | |
{ | |
display.drawLine(80, 40, 80, 20, WHITE); | |
display.fillTriangle(70, 20, 90, 20, 80, 5, WHITE); | |
} | |
display.display(); | |
Serial.println(temp); | |
delay(300000); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment