PlatformIO Community

Platformio does not upload to Arduino Uno

Hi!
I am a little frustrated with the platformio:
Somehow it does not upload anything to my arduino unit board though it says it does.
It took me some time to get to this point.

Here is a simple sketch that I ran in the Arduino Software and uploaded it:
#include <Wire.h>
#include <RTC.h>

static DS3231 RTC;

void setup()
{ 
  Serial.begin(9600);
  RTC.begin();
}

void loop()
{  
int yearNow; 
int monthNow, dateNow, hourNow, minuteNow, secondNow, weekNow;
  
if (RTC.isRunning())
  {
    yearNow=RTC.getYear();
    monthNow =RTC.getMonth();
    dateNow=RTC.getDay();
    weekNow=RTC.getWeek();
    hourNow=RTC.getHours();
    minuteNow=RTC.getMinutes();
    secondNow=RTC.getSeconds();
   
    Serial.print("Weekday: ");
    Serial.print(weekNow);
    Serial.print("  Time:");
    // Finally the hour, minute, and second
    Serial.print(hourNow);
    Serial.print("-");
    Serial.print(minuteNow);
    Serial.print("-");
    Serial.print(secondNow);
    Serial.print(" ##  ");    
    Serial.print("Date: ");
    Serial.print(yearNow);
    Serial.print("/");
    Serial.print(monthNow);
    Serial.print("/");
    Serial.println(dateNow);
    
  }
}

This is what I get then in serial monitor as expected:
Weekday: 5 Time:9-19-50 ## Date: 2020/7/29
Weekday: 5 Time:9-19-50 ## Date: 2020/7/29
Weekday: 5 Time:9-19-50 ## Date: 2020/7/29
Weekday: 5 Time:9-19-50 ## Date: 2020/7/29

I ran the same sketch in the Visual Studio Code on Mac OSX 10.13.6 with this compilation results:

Processing uno (platform: atmelavr; board: uno; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR 2.2.0 > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
- framework-arduino-avr 5.0.0
- tool-avrdude 1.60300.200527 (6.3.0)
- toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies…
No dependencies
Building in release mode
Checking size .pio/build/uno/firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [ ] 0.4% (used 9 bytes from 2048 bytes)
Flash: [ ] 1.4% (used 444 bytes from 32256 bytes)
Configuring upload protocol…
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port…
Auto-detected: /dev/cu.usbmodem1411
Uploading .pio/build/uno/firmware.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file ".pio/build/uno/firmware.hex"
avrdude: writing flash (444 bytes):

Writing | ################################################## | 100% 0.08s

avrdude: 444 bytes of flash written
avrdude: verifying flash memory against .pio/build/uno/firmware.hex:
avrdude: load data flash data from input file .pio/build/uno/firmware.hex:
avrdude: input file .pio/build/uno/firmware.hex contains 444 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.07s

avrdude: verifying ...
avrdude: 444 bytes of flash verified

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.
================================================ [SUCCESS] Took 2.51 seconds 

This got me nothing on the serial monitor. Screenshot from Coolterm:
Bildschirmfoto 2020-07-29 um 09.26.06

What can I do about it?

Thanks!!

Hello !

I don’t know anything about Mac or VSC, but are you sure you’re compiling the right file with VSC ? Because PIO is telling you that the program take only 444 bytes (1.4%) on Flash and 9 bytes on RAM, which is really few I think, seems to me that PIO is building a blank program.
If I believe my PIO output, your program should be at least 4 000 bytes (12%) on Flash and 400 bytes on RAM.

Thanks. Yes you are right.
I was too dumb. I forgot that Platformio compiles what is in the src - folder :frowning:
I had the files outside of it and thought I might compile them as with arduino tool.