Skip to main content

PlatformIO

Installation​

Uploading a sketch to the ATMega16​

Folder structure​

./
├── lib/
├── platformio.ini
└── src/
└── main.c
platformio.ini
[env:ATmega16]
platform = atmelavr
framework = arduino
board = ATmega16
board_build.f_cpu = 8000000L
board_fuses.efuse = 0xFF
board_fuses.hfuse = 0xD1
board_fuses.lfuse = 0xC4
upload_protocol = stk500
upload_flags = -e

Setting up PlatformIO (for VS Code)​

pio init --ide vscode

The sketch​

main.c
#include <avr/io.h>

int main(void) {
DDRB = 0xff;
DDRD = 0x0;

while (1) {
PORTB = ~PIND;
}
}

Compilation and upload​

pio run --target upload