Badge Claim: Nasty Hacker
For ACDC 2026, we proudly claim the Nasty Hacker badge. Our solution is held together by duct tape, blind faith, the hope for many dooh badges (not claiming now :p ), and a collection of hacks that would make any code reviewer weep. We regret nothing.
The Crime Scene: A micro:bit with 16KB of RAM
Our goal was simple: detect motion and call an Azure Function. The reality? A brutal fight against hardware limitations. Here are the dirty hacks we deployed:
1. The Great Memory Purge
The micro:bit v1 has roughly 16KB of usable RAM. Our first working script? MemoryError. Our solution was a scorched-earth approach:
- Removed all comments (yes, they take space).
- Shortened every variable name (wifi_ok → w,
previous_pin→ pp). - Deleted the entire OLED display feature because the font dictionary alone was too large.

2. Hardcoded Delays Everywhere
We communicate with an ESP8266 WiFi module using raw AT commands over UART. Parsing the response properly? Too complex. Instead, we just… wait and hope.
at("AT+RST", 2000) # Reset. Wait 2 seconds. Pray.
sleep(2000) # Wait some more. Just in case.
at("AT+CWMODE=1", 2000) # Set mode. More waiting.
If the network is slow, we fail. If it’s fast, we waste time. It’s beautifully terrible.
3. Manual Garbage Collection in the Main Loop
To prevent the device from crashing mid-operation, we added gc.collect() directly into our while True loop. Every single iteration, we beg Python to free up memory. It’s not elegant, but it works.
4. DIY Edge Detection
Need to detect when the PIR sensor stops seeing motion? There’s no library for that. Our hack:
if pp == 1 and p == 0: # Previous was HIGH, now LOW? Motion ended!
Two variables, one if statement, zero elegance.
5. Rate Limiting with running_time()
To avoid spamming Azure, we implemented rate limiting. Our sophisticated solution? “Has it been 10 seconds since the last call?” That’s it. No queues, no proper debouncing. Just a timestamp and a prayer.
We are not proud. We are not ashamed. We are Nasty Hackers, and our code works. Barely.