ported an arduino c example to avr.