Migrated from Arduino sketch to C code + Makefile