September 2019 · Last updated 2021-02-07 · 329 words
Already over a month ago I visited the Chaos Communication Camp 2019 and it was a total blast!
My first CCC Camp experience, and surely not my last.
The badge team outdid themselves again with the card10 smart watch.
I loved all the sci-fi backstory about how they heard what the thing would be able to do from recovered info from the future :)
Anyhow, you can program the card10 in MicroPython.
At the camp, I started to write a tiny Snake clone using the card10’s accelerometer.
It’s only half done, but I loved how much I could do with so few lines of (readable) code.
Today a friend who just started programming asked me when it was the last time coding gave me a great feeling of accomplishment, I said it was the axelerometersnek.
Here’s the source code:
sens = bhi160.BHI160Accelerometer()
disp = display.open()
q =  # queue
QLEN = 10 # enuff is enuff!def clamp(val):
return -1.0 if val < -1.0 else 1.0 if val > 1.0 else val
utime.sleep(0.03) # 30 fps
samples = sens.read()
for s in samples:
if len(q) == QLEN:
x = 160 - int((clamp(s.x) + 1.0) * 80)
y = int((clamp(s.y) + 1.0) * 40)
for i in range(0, len(q) - 1):
c = int(20 + 235 * i / (len(q) - 1)) # color
disp.line(q[i], q[i], q[i+1], q[i+1],
col = (c,c,c), size = 1)
So few lines, so many stupid bugs. This is already revision 3 😹