Skip to content

Instantly share code, notes, and snippets.

@hussienzy
Created April 14, 2022 01:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hussienzy/3cf6c1d929aaf793029aca9fff975c8d to your computer and use it in GitHub Desktop.
This is the code for the Maker Uno DHT11 Alphanumeric Display
1#include <Wire.h>
#include "grove_alphanumeric_display.h"
#include "DHT.h"
#define DHTPIN 2 // what digital pin we're connected to
#define DHTTYPE DHT11 // DHT 11
Seeed_Digital_Tube tube;
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// put your setup code here, to run once:
Wire.begin();
dht.begin();
tube.setTubeType(TYPE_4,TYPE_4_DEFAULT_I2C_ADDR);
tube.setBrightness(10);
tube.setBlinkRate(BLINK_OFF);
}
void loop() {
// put your main code here, to run repeatedly:
welcome();
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
tube.displayString("Humidity: ",100);
tube.displayNum(h,100);
delay(500);
tube.displayString("Temperature: ", 100);
tube.displayNum(t,100);
delay(500);
tube.displayString("°C ", 100);
delay(500);
}
void welcome()
{
tube.displayString("MAKER UNO + DHT11 + ALPHA DISPLAY", 100);
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment