added first bits for pure AVR version (use HAVE_ARDUINO as switch)