Blinking a BugOne

The BugOne is a small board with an ATMega168 and a RFM12 wireless module, and today I’m going to blink its two LEDs.

The BugOne board is powered via the USB programmer (USBASP v2.0, Lcsoft studio, bought on eBay) and no extra components are needed (see picture). Note for the future, connector’s ground is oriented toward the ATMega.

On Ubuntu 12.10 (and on other Linux OSes) a rule has to be added in udev to allow programming without root access. Edit /etc/udev/rules.d/USBasp.rules and write:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="users", MODE="0666"

The source code is pretty small, I restricted headers at maximum. The extra avr_compat.h file is available in the archive at the end of the post and allows an easy control of AVR I/Os.

#include <avr/io.h>
#include <util/delay.h>
#include "avr_compat.h"

/* Pinout of leds */
#define LED1 C,1
#define LED2 C,0

int main() {


	while (1) {

The Makefile (in the archive) is a bit over-engineered for such a simple example but it is a simplified version of the BugOne project’s one. To compile the source, you will need “make”, “gcc-avr”, “avrdude” packages. Just use make and make load commands and its blinking … Awesome !

AVR1 – Source + Makefile

2 Replies to “Blinking a BugOne”

Leave a Reply

Your email address will not be published. Required fields are marked *