Upload to Arduino Uno

I have three projects I’m using to teach myself.

  1. Read a DT11 Sensor
  2. Use a 4 digit 7 Segment LED
  3. Try to combine the two and display the temperature.

The issue I’m having is for some reason I can’t simply upload code to the Arduino Uno board. I’ve had no issue until this removing projects and creating new projects as I learn more.
I’ve read quite a few historical similar topics and for example added upload_flags = -e to platformio.ini
I’m using the same Arduino UNO board with the correct port settings etc, but this is what I see in the terminal when I execute a download?

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (5.0.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.2.0 
 - tool-avrdude @ 1.60300.200527 (6.3.0) 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 8 compatible libraries
Scanning dependencies...
Dependency Graph
|-- SevSeg @ 3.7.1
|-- DHT sensor library @ 1.4.6
|-- Adafruit Unified Sensor @ 1.1.14
Building in release mode
Checking size .pio\build\uno\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   8.7% (used 179 bytes from 2048 bytes)
Flash: [==        ]  16.3% (used 5272 bytes from 32256 bytes)
Configuring upload protocol...
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port...
Auto-detected: COM4
Uploading .pio\build\uno\firmware.hex
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

*** [upload] Error 1
==================================================== [FAILED] Took 3.36 seconds ====================================================

 *  The terminal process "C:\Users\derek\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

I can’t work out why the comms would fail when it usually works?

Are you sure COM4 is the right port? Check your Windows device manager if you have multiple ones.

Also make sure that nothing is connected to the D0 and D1 pins, since those are the bootloader / serial pins.
If possible, disconnect all external circuitry from the board.

Another cause could be that you need a different upload_speed to talk to the bootloader, usually 115200 baud, but sometimes different like 74880.

SOLVED,

Hello Max, thanks for your reply, I had used the D0 pin, removing that and I can now download again.

I wasn’t aware of the importance of D0 and D1, but now found this explanation from the Arduino site:

You would be able to use pin 1 as a GPIO pin, however you cannot use pin 0 as a GPIO, this is because the arguing has TX/RX pins that are used to program the Arduino and connect to some external modules.
RX is the receiver part of this communication system, it can then output normally if you are not using any external modules. TX is always transmitting so it cannot be used just like any other pin.
This is why they say the UNO is said to have 13 GPIO pins even though the there are 14 digital pins