MONITOR TEMPERATURE HUMIDITY DHT11 PANEL P10 RGB HUB75
Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat memonitor suhu dan kelembaban dengan menggunakan interface panel p10 rgb dengan hub75 dan Arduino. untuk lebih jelasnya berikut adalah komponen dan kodingnya.
a. Arduino Uno
b. Panel P10 RGB HUB75
c. Sensor DHT11
d. Program Arduino IDE
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <RGBmatrixPanel.h>
#include "DHT.h" //library dht11
#define DHTPIN 10 // pin digital untuk dht11
#define DHTTYPE DHT11 // set dht11
DHT dht(DHTPIN, DHTTYPE); //set dht11
#define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr
#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT A3
#define OE 9
#define A A0
#define B A1
#define C A2
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);
String t,h;
int suhu,humy;
void setup()
{
dht.begin(); //mulai dht11
matrix.begin();
matrix.setTextWrap(false); // Allow text to run off right edge
matrix.setTextSize(1);
}
void loop()
{
humy = dht.readHumidity(); //ambil data humidity
suhu = dht.readTemperature(); //ambil data suhu c
t = String(suhu);
h = String(humy);
matrix.fillScreen(0);
matrix.setTextColor(matrix.Color444(1, 0, 0));
matrix.setCursor(1, 1); //x,y
matrix.print("T:");
matrix.setTextColor(matrix.Color444(0, 1, 0));
matrix.print(t);
matrix.setTextColor(matrix.Color444(1, 1, 15));
matrix.setCursor(1, 8); //x,y
matrix.print("H:");
matrix.setTextColor(matrix.Color444(3, 1, 0));
matrix.print(h);
delay(1000);
}
e. VIDEO HASILNYA
#include <Adafruit_GFX.h>
#include <RGBmatrixPanel.h>
#include "DHT.h" //library dht11
#define DHTPIN 10 // pin digital untuk dht11
#define DHTTYPE DHT11 // set dht11
DHT dht(DHTPIN, DHTTYPE); //set dht11
#define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr
#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT A3
#define OE 9
#define A A0
#define B A1
#define C A2
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);
String t,h;
int suhu,humy;
void setup()
{
dht.begin(); //mulai dht11
matrix.begin();
matrix.setTextWrap(false); // Allow text to run off right edge
matrix.setTextSize(1);
}
void loop()
{
humy = dht.readHumidity(); //ambil data humidity
suhu = dht.readTemperature(); //ambil data suhu c
t = String(suhu);
h = String(humy);
matrix.fillScreen(0);
matrix.setTextColor(matrix.Color444(1, 0, 0));
matrix.setCursor(1, 1); //x,y
matrix.print("T:");
matrix.setTextColor(matrix.Color444(0, 1, 0));
matrix.print(t);
matrix.setTextColor(matrix.Color444(1, 1, 15));
matrix.setCursor(1, 8); //x,y
matrix.print("H:");
matrix.setTextColor(matrix.Color444(3, 1, 0));
matrix.print(h);
delay(1000);
}
e. VIDEO HASILNYA
No comments:
Post a Comment