Hi guys
I’m back again with another challenge;
The hardware:
I’m playing with a digispark clone - and an OLED display.
That works fine
P0 - SDA
P1 - N/C
P2 - SCK (typo on board, should be SCL)
P3 - N/C
P4 - N/C
P5 - N/C (used as reset or something in clones - this one is off limits anyway)
The code:
I’m trying to make a kitchen timer-like project that counts seconds since a switch was flicked.
The problem:
I need to free 60 bytes to make it fit.
What’s been tried:
Replaced the bootloaded for a space-aggressive version (micronucleus 1.11)
Used boolean instead of integer
Cleared out all code notation (yes I know this doesn’t make a difference, made me feel better though)
Attempted to reference gpio directly, instead of using digitalread (need some help with this)
Tried to streamline Tiny4kOLED.h to remove unused fonts (I only need one)
My code (modified from example):
#include <Tiny4kOLED.h>
#include <TinyWireM.h>
int Sec = 0;
boolean BS = false;
void setup() {
oled.begin();
oled.clear();
oled.on();
pinMode(1, INPUT);
}
void loop() {
delay(1000);
BS = digitalRead(1);
if (BS == true); {
oled.clear();
oled.setFont(FONT16X32);
oled.setCursor(0, 0);
oled.print(Sec);
Sec = Sec + 1;
}
}
Greatly appreciate your time guys - any suggestions will help me build my skill with C++