Hi I just started tinkering with the ATtiny 1-series on PlatformIO. I managed to create a blink program that worked flawlessly. However when I added the command to print to the serial port, it only outputted garbage. I know this isn’t an issue with my hardware or my code because I tried it in the ArduinoIDE and it worked normally.
Here is my code:
#include <Arduino.h>
#include <avr/io.h>
#define LED_AVR PIN3_bm
void setup() {
PORTA.DIRSET = LED_AVR;
Serial.begin(9600);
}
void loop() {
PORTA.OUT |= LED_AVR;
Serial.println("Led ON");
delay(1000);
PORTA.OUT &= ~LED_AVR;
Serial.println("Led OFF");
delay(1000);
}
And here is my platformio.ini file:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:ATtiny416]
platform = atmelmegaavr
board = ATtiny416
framework = arduino
upload_protocol = custom
upload_command = pyupdi -d tiny416 -b 19200 -c COM9 -f .pio\build\ATtiny416\firmware.hex -v
Thanks for the help