aboutsummaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorBlaise Thompson <blaise@untzag.com>2021-07-26 17:46:31 -0500
committerBlaise Thompson <blaise@untzag.com>2021-07-26 17:46:31 -0500
commit70b147b23d83fcf62637a4b6a63ad58e56fffc27 (patch)
tree5040cf9ea4f5c32837cb00cbd8bdaf3317d56e58 /firmware
initial commit
Diffstat (limited to 'firmware')
-rwxr-xr-xfirmware/firmware.ino26
1 files changed, 26 insertions, 0 deletions
diff --git a/firmware/firmware.ino b/firmware/firmware.ino
new file mode 100755
index 0000000..180f8e4
--- /dev/null
+++ b/firmware/firmware.ino
@@ -0,0 +1,26 @@
+float setpoint = 30.;
+float current = 0.;
+
+int heat = 12; // pin 12
+int cool = 11; // pin 11
+
+void setup() {
+ pinMode(cool, OUTPUT);
+ pinMode(heat, OUTPUT);
+ analogReference(INTERNAL);
+ Serial.begin(9600);
+}
+
+void loop() {
+ current = (float) analogRead(A0) * 223/1024;
+ Serial.println(current);
+ if (setpoint > current) {
+ digitalWrite(heat, HIGH);
+ digitalWrite(cool, LOW);
+ }
+ else if (setpoint < current) {
+ digitalWrite(heat, LOW);
+ digitalWrite(cool, HIGH);
+ }
+ delay(1000);
+}