Hello everyone, thanks for taking the time to look at this.
I've recently got into Arduino with zero programming skills, and only slightly more wiring skills. So far, I've been decently self-sufficient, and I'm currently going through Paul McWhorter's Arduino lessons on YouTube. The videos are teaching me seemingly everything in due time, but I've decided to also start a small gadget in the meantime.
Inside the bedroom, I've set up an Arduino Uno R3, three DS18B20 temp sensors (with pull-up resistor), and a run-of-the-mill 0.96" OLED. One temp sensor is placed in the central air vent, one is in a 'general' area of the room, and another is poking out pf the window for an outdoor reading.
After seeing some videos showing the capabilities of an Arduino in a smarter person's hands, I'm confused as to how my sketch is over 25,600 bytes. I didn't expect my code to have the body to rock a Speedo to the beach, but that seems a bit "fluffy" to me.
Sorry for the lack of commenting in the code, I'm generally good about it, but there isn't really any rocket surgery involved in this:
#include <OneWire.h>
#include <DallasTemperature.h>
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
//Sensor Index IDs: Outside is (0), Bedroom is (1), Vent is (2)
void setup(void)
{
Serial.begin(9600);
}
void loop(void)
{
sensors.requestTemperatures();
delay(1000);
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
delay(1000);
}
void draw(void)
{
u8g.drawFrame(1,1,127,63);
u8g.drawVLine(85, 1, 64);
u8g.drawHLine(85, 32, 127);
u8g.setFont(u8g_font_helvR24);
u8g.setPrintPos(14, 53);
u8g.print(sensors.getTempFByIndex(1),1);
u8g.setFont(u8g_font_ncenR10);
u8g.setPrintPos(16, 20);
u8g.print("Bedroom");
u8g.setPrintPos(92, 15);
u8g.print("Vent");
u8g.setPrintPos(93, 29);
u8g.print(sensors.getTempFByIndex(2),1);
u8g.setPrintPos(95, 46);
u8g.print("Out");
u8g.setPrintPos(93, 60);
u8g.print(sensors.getTempFByIndex(0),1);
}
Any assistance as to what I should be doing to put this on a diet?
Thanks again!