Skip to content

Commit cb099ae

Browse files
committed
Add automato_helloWorld sketch to match latest board file release.
1 parent dabc753 commit cb099ae

File tree

2 files changed

+102
-5
lines changed

2 files changed

+102
-5
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* Automato "Hello World"
3+
* - Blink an LED
4+
* - Print to serial
5+
* - Read the Temperature sensor
6+
* - Display the temperature on the screen
7+
*
8+
* Chris Chronopoulos 20210721
9+
10+
*
11+
*/
12+
#include "SPI.h"
13+
#include "Adafruit_GFX.h"
14+
#include "Adafruit_ILI9341.h"
15+
16+
#include "SparkFun_SHTC3.h"
17+
18+
19+
Adafruit_ILI9341 tft = Adafruit_ILI9341(PIN_LCD_CS, PIN_LCD_DC, MOSI, SCK, PIN_LCD_RST, MISO);
20+
SHTC3 shtc3;
21+
float temperature, humidity;
22+
23+
void setup() {
24+
25+
// user LED
26+
pinMode(PIN_LED, OUTPUT);
27+
28+
// USB serial
29+
Serial.begin(115200);
30+
while(!Serial)
31+
32+
// LCD
33+
pinMode(PIN_LED_LCD, OUTPUT);
34+
digitalWrite(PIN_LED_LCD, HIGH);
35+
tft.begin();
36+
tft.setRotation(1);
37+
38+
// SHTC3
39+
Wire.begin();
40+
shtc3.begin();
41+
42+
delay(1000);
43+
Serial.println("hello world!");
44+
45+
}
46+
47+
void updateLCD() {
48+
49+
tft.fillScreen(ILI9341_BLACK);
50+
51+
tft.setCursor(0,0);
52+
tft.setTextColor(ILI9341_GREEN);
53+
tft.setTextSize(4);
54+
tft.println("Hello World!");
55+
tft.println();
56+
57+
tft.setTextSize(2);
58+
59+
tft.setTextColor(ILI9341_RED);
60+
tft.print("Temperature = ");
61+
tft.print(temperature);
62+
tft.println(" F");
63+
tft.println();
64+
65+
tft.setTextColor(ILI9341_BLUE);
66+
tft.print("Humidity = ");
67+
tft.print(humidity);
68+
tft.println("%");
69+
tft.println();
70+
71+
}
72+
73+
74+
void loop() {
75+
76+
// get a reading from the temp/humidity sensor
77+
shtc3.update();
78+
temperature = shtc3.toDegF();
79+
humidity = shtc3.toPercent();
80+
81+
// output to serial
82+
Serial.print("RH = ");
83+
Serial.print(shtc3.toPercent());
84+
Serial.print("%, T = ");
85+
Serial.print(shtc3.toDegF());
86+
Serial.println(" deg F");
87+
88+
// output to LCD
89+
updateLCD();
90+
91+
// blinky blink
92+
digitalWrite(PIN_LED, HIGH); // turn the LED on (HIGH is the voltage level)
93+
delay(1000); // wait for a second
94+
digitalWrite(PIN_LED, LOW); // turn the LED off by making the voltage LOW
95+
delay(1000);
96+
97+
}

package_automato_index.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
{
1010
"name": "Automato Sensor Module (ESP32-based)",
1111
"architecture": "esp32",
12-
"version": "0.0.0",
12+
"version": "0.0.1",
1313
"category": "ESP32",
14-
"url": "https://github.com/InterstitialTech/automato-arduino/releases/download/v0.0.0/automato-0.0.0.zip",
15-
"archiveFileName": "automato-0.0.0.zip",
16-
"checksum": "SHA-256:BE5EDCC1538DC6DE4B5487BB548A363440E51F46A9BD1F606A61C0B267D285E3",
17-
"size": "51334563",
14+
"url": "https://github.com/InterstitialTech/automato-arduino/releases/download/v0.0.1/automato-0.0.1.zip",
15+
"archiveFileName": "automato-0.0.1.zip",
16+
"checksum": "SHA-256:36653090B57F72AD531BD92DBA616DF12813797E2008142F0683B44F77E7DA6F",
17+
"size": "51289424",
1818
"help": {
1919
"online": ""
2020
},

0 commit comments

Comments
 (0)