Skip to content

Commit 4f10376

Browse files
authored
Merge pull request #5 from navalog/main
Example TemperatureHumidityMatrix
2 parents c404e59 + 72a6a8e commit 4f10376

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include "Modulino.h"
2+
#include "ArduinoGraphics.h"
3+
#include "Arduino_LED_Matrix.h"
4+
5+
ModulinoThermo thermo;
6+
ArduinoLEDMatrix matrix;
7+
8+
float temperature = -273.15;
9+
float humidity = 0.0;
10+
11+
void setup() {
12+
Serial.begin(9600);
13+
14+
Modulino.begin();
15+
thermo.begin();
16+
17+
matrix.begin();
18+
delay(100);
19+
}
20+
21+
void loop() {
22+
//Acquire temperature and humidity
23+
temperature = thermo.getTemperature();
24+
humidity = thermo.getHumidity();
25+
26+
//Convert the temperature float to a string with 1 decimal point shown
27+
//and add °C at the end
28+
String temperature_text = String(temperature, 1) + "°C";
29+
30+
//Convert the humidity float to a string with no decimal points shown
31+
//and add % at the end
32+
String humidity_text = String(humidity, 0) + "%";
33+
34+
//Print each of the sensor values on serial
35+
Serial.print(temperature_text + " ");
36+
Serial.println(humidity_text);
37+
38+
//Show on the UNO R4 WiFi LED matrix the data
39+
40+
matrix.beginDraw();
41+
matrix.stroke(0xFFFFFFFF);
42+
matrix.textScrollSpeed(75);
43+
matrix.textFont(Font_5x7);
44+
matrix.beginText(0, 1, 0xFFFFFF);
45+
matrix.println(" " + temperature_text + " " + humidity_text + " ");
46+
matrix.endText(SCROLL_LEFT);
47+
matrix.endDraw();
48+
}

0 commit comments

Comments
 (0)