Tonight I’m making a little Arduino mains relay timer. It’s for the box fan in my room. The timer built into the fan broke years ago but even before it did, the ticking noise was distracting when trying to go to sleep! But leaving it on all night means I wake up extra dehydrated. Hence, an electronic 2-hour timer for my fan.

Here's the code. (not yet tested tho!)
It compiles to 1222 entire bytes and uses a whole 10 bytes of RAM! I love embedded processors :crt_w_prompt: :blobsunglasses:

Show thread

revisions to code: replace the hardcoded LOW/HIGH with constants, as it turns out the relay module is active-low; replace clockCounting with clockStart and == with >= in the comparison, whoops.

Show thread

@kirby unplug it, haha. I can use the off switch on the fan itself if I need to turn it off manually.

Follow

@kirby you know what, I think tomorrow I’ll change it so pressing it while it’s on does turn it off. Doesn’t hurt to have that option.

Sign in to participate in the conversation
Cybrespace

cybrespace: the social hub of the information superhighway jack in to the mastodon fediverse today and surf the dataflow through our cybrepunk, slightly glitchy web portal support us on patreon or liberapay!