Arduino code not compiling

So I switched from the Arduino IDE to platformIO after having the same compilation problem,thinking it would go away(btw this problem arose recently,beforehand I used to upload code normally),so when i write some code and try to upload it via the upload icon in the bottom bar ,I get this output:

`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 (5.1.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 6 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:   [=         ]   9.2% (used 188 bytes from 2048 bytes)
Flash: [          ]   4.9% (used 1576 bytes from 32256 bytes)
Configuring upload protocol...
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port...
Using manually specified: /dev/ttyS4
Uploading .pio/build/uno/firmware.hex
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

*** [upload] Error 1`

should I consider buying a new board or is it another problem?

Have you specified an upload port in your project’s platformio.ini file? The error messages imply that you have. If so, delete it and let the system locate it for you. This might help.

Cheers,
Norm.

thanks for replying,I reset the port from dev4 to Auto but the same problem persists,for ref that is the terminal output:


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 (5.1.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 6 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:   [=         ]   9.2% (used 188 bytes from 2048 bytes)
Flash: [          ]   4.9% (used 1576 bytes from 32256 bytes)
Configuring upload protocol...
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port...
Auto-detected: /dev/ttyS4
Uploading .pio/build/uno/firmware.hex
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

*** [upload] Error 1
==========================

here is an image of my screen:

What’s the output of

lsusb

and

ls -la /dev/tty*

when I open the terminal(I am in ubuntu) and type:
lsusb

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 0a5c:5843 Broadcom Corp. 58200
Bus 003 Device 003: ID 0bda:5532 Realtek Semiconductor Corp. Integrated_Webcam_HD
Bus 003 Device 011: ID 1c4f:0034 SiGma Micro XM102K Optical Wheel Mouse
Bus 003 Device 005: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

'ls -la /dev/tty '*:

crw-rw-rw- 1 root  tty     5,  0 Jan  8 09:12 /dev/tty
crw--w---- 1 root  tty     4,  0 Jan  8 09:12 /dev/tty0
crw--w---- 1 root  tty     4,  1 Jan  8 09:12 /dev/tty1
crw--w---- 1 root  tty     4, 10 Jan  8 09:12 /dev/tty10
crw--w---- 1 root  tty     4, 11 Jan  8 09:12 /dev/tty11
crw--w---- 1 root  tty     4, 12 Jan  8 09:12 /dev/tty12
crw--w---- 1 root  tty     4, 13 Jan  8 09:12 /dev/tty13
crw--w---- 1 root  tty     4, 14 Jan  8 09:12 /dev/tty14
crw--w---- 1 root  tty     4, 15 Jan  8 09:12 /dev/tty15
crw--w---- 1 root  tty     4, 16 Jan  8 09:12 /dev/tty16
crw--w---- 1 root  tty     4, 17 Jan  8 09:12 /dev/tty17
crw--w---- 1 root  tty     4, 18 Jan  8 09:12 /dev/tty18
crw--w---- 1 root  tty     4, 19 Jan  8 09:12 /dev/tty19
crw--w---- 1 mehdi tty     4,  2 Jan  8 09:12 /dev/tty2
crw--w---- 1 root  tty     4, 20 Jan  8 09:12 /dev/tty20
crw--w---- 1 root  tty     4, 21 Jan  8 09:12 /dev/tty21
crw--w---- 1 root  tty     4, 22 Jan  8 09:12 /dev/tty22
crw--w---- 1 root  tty     4, 23 Jan  8 09:12 /dev/tty23
crw--w---- 1 root  tty     4, 24 Jan  8 09:12 /dev/tty24
crw--w---- 1 root  tty     4, 25 Jan  8 09:12 /dev/tty25
crw--w---- 1 root  tty     4, 26 Jan  8 09:12 /dev/tty26
crw--w---- 1 root  tty     4, 27 Jan  8 09:12 /dev/tty27
crw--w---- 1 root  tty     4, 28 Jan  8 09:12 /dev/tty28
crw--w---- 1 root  tty     4, 29 Jan  8 09:12 /dev/tty29
crw--w---- 1 root  tty     4,  3 Jan  8 09:12 /dev/tty3
crw--w---- 1 root  tty     4, 30 Jan  8 09:12 /dev/tty30
crw--w---- 1 root  tty     4, 31 Jan  8 09:12 /dev/tty31
crw--w---- 1 root  tty     4, 32 Jan  8 09:12 /dev/tty32
crw--w---- 1 root  tty     4, 33 Jan  8 09:12 /dev/tty33
crw--w---- 1 root  tty     4, 34 Jan  8 09:12 /dev/tty34
crw--w---- 1 root  tty     4, 35 Jan  8 09:12 /dev/tty35
crw--w---- 1 root  tty     4, 36 Jan  8 09:12 /dev/tty36
crw--w---- 1 root  tty     4, 37 Jan  8 09:12 /dev/tty37
crw--w---- 1 root  tty     4, 38 Jan  8 09:12 /dev/tty38
crw--w---- 1 root  tty     4, 39 Jan  8 09:12 /dev/tty39
crw--w---- 1 root  tty     4,  4 Jan  8 09:12 /dev/tty4
crw--w---- 1 root  tty     4, 40 Jan  8 09:12 /dev/tty40
crw--w---- 1 root  tty     4, 41 Jan  8 09:12 /dev/tty41
crw--w---- 1 root  tty     4, 42 Jan  8 09:12 /dev/tty42
crw--w---- 1 root  tty     4, 43 Jan  8 09:12 /dev/tty43
crw--w---- 1 root  tty     4, 44 Jan  8 09:12 /dev/tty44
crw--w---- 1 root  tty     4, 45 Jan  8 09:12 /dev/tty45
crw--w---- 1 root  tty     4, 46 Jan  8 09:12 /dev/tty46
crw--w---- 1 root  tty     4, 47 Jan  8 09:12 /dev/tty47
crw--w---- 1 root  tty     4, 48 Jan  8 09:12 /dev/tty48
crw--w---- 1 root  tty     4, 49 Jan  8 09:12 /dev/tty49
crw--w---- 1 root  tty     4,  5 Jan  8 09:12 /dev/tty5
crw--w---- 1 root  tty     4, 50 Jan  8 09:12 /dev/tty50
crw--w---- 1 root  tty     4, 51 Jan  8 09:12 /dev/tty51
crw--w---- 1 root  tty     4, 52 Jan  8 09:12 /dev/tty52
crw--w---- 1 root  tty     4, 53 Jan  8 09:12 /dev/tty53
crw--w---- 1 root  tty     4, 54 Jan  8 09:12 /dev/tty54
crw--w---- 1 root  tty     4, 55 Jan  8 09:12 /dev/tty55
crw--w---- 1 root  tty     4, 56 Jan  8 09:12 /dev/tty56
crw--w---- 1 root  tty     4, 57 Jan  8 09:12 /dev/tty57
crw--w---- 1 root  tty     4, 58 Jan  8 09:12 /dev/tty58
crw--w---- 1 root  tty     4, 59 Jan  8 09:12 /dev/tty59
crw--w---- 1 root  tty     4,  6 Jan  8 09:12 /dev/tty6
crw--w---- 1 root  tty     4, 60 Jan  8 09:12 /dev/tty60
crw--w---- 1 root  tty     4, 61 Jan  8 09:12 /dev/tty61
crw--w---- 1 root  tty     4, 62 Jan  8 09:12 /dev/tty62
crw--w---- 1 root  tty     4, 63 Jan  8 09:12 /dev/tty63
crw--w---- 1 root  tty     4,  7 Jan  8 09:12 /dev/tty7
crw--w---- 1 root  tty     4,  8 Jan  8 09:12 /dev/tty8
crw--w---- 1 root  tty     4,  9 Jan  8 09:12 /dev/tty9
crw------- 1 root  root    5,  3 Jan  8 09:12 /dev/ttyprintk
crw-rw---- 1 root  dialout 4, 64 Jan  8 09:12 /dev/ttyS0
crw-rw---- 1 root  dialout 4, 65 Jan  8 09:12 /dev/ttyS1
crw-rw---- 1 root  dialout 4, 74 Jan  8 09:12 /dev/ttyS10
crw-rw---- 1 root  dialout 4, 75 Jan  8 09:12 /dev/ttyS11
crw-rw---- 1 root  dialout 4, 76 Jan  8 09:12 /dev/ttyS12
crw-rw---- 1 root  dialout 4, 77 Jan  8 09:12 /dev/ttyS13
crw-rw---- 1 root  dialout 4, 78 Jan  8 09:12 /dev/ttyS14
crw-rw---- 1 root  dialout 4, 79 Jan  8 09:12 /dev/ttyS15
crw-rw---- 1 root  dialout 4, 80 Jan  8 09:12 /dev/ttyS16
crw-rw---- 1 root  dialout 4, 81 Jan  8 09:12 /dev/ttyS17
crw-rw---- 1 root  dialout 4, 82 Jan  8 09:12 /dev/ttyS18
crw-rw---- 1 root  dialout 4, 83 Jan  8 09:12 /dev/ttyS19
crw-rw---- 1 root  dialout 4, 66 Jan  8 09:12 /dev/ttyS2
crw-rw---- 1 root  dialout 4, 84 Jan  8 09:12 /dev/ttyS20
crw-rw---- 1 root  dialout 4, 85 Jan  8 09:12 /dev/ttyS21
crw-rw---- 1 root  dialout 4, 86 Jan  8 09:12 /dev/ttyS22
crw-rw---- 1 root  dialout 4, 87 Jan  8 09:12 /dev/ttyS23
crw-rw---- 1 root  dialout 4, 88 Jan  8 09:12 /dev/ttyS24
crw-rw---- 1 root  dialout 4, 89 Jan  8 09:12 /dev/ttyS25
crw-rw---- 1 root  dialout 4, 90 Jan  8 09:12 /dev/ttyS26
crw-rw---- 1 root  dialout 4, 91 Jan  8 09:12 /dev/ttyS27
crw-rw---- 1 root  dialout 4, 92 Jan  8 09:12 /dev/ttyS28
crw-rw---- 1 root  dialout 4, 93 Jan  8 09:12 /dev/ttyS29
crw-rw---- 1 root  dialout 4, 67 Jan  8 09:12 /dev/ttyS3
crw-rw---- 1 root  dialout 4, 94 Jan  8 09:12 /dev/ttyS30
crw-rw---- 1 root  dialout 4, 95 Jan  8 09:12 /dev/ttyS31
crw-rw---- 1 root  dialout 4, 68 Jan  8 22:06 /dev/ttyS4
crw-rw---- 1 root  dialout 4, 69 Jan  8 09:12 /dev/ttyS5
crw-rw---- 1 root  dialout 4, 70 Jan  8 09:12 /dev/ttyS6
crw-rw---- 1 root  dialout 4, 71 Jan  8 09:12 /dev/ttyS7
crw-rw---- 1 root  dialout 4, 72 Jan  8 09:12 /dev/ttyS8
crw-rw---- 1 root  dialout 4, 73 Jan  8 09:12 /dev/ttyS9

From that output there doesn’t seem to be an Arduino Uno connected at all.

Please do the following:

  1. Plug out the Uno.
  2. In a new terminal, execute sudo dmesg -w
  3. Enter the password as needed and press enter once
  4. Plug the Uno back in
  5. Post what new text has appeared.

So i plugged out the Uno,typed that command got some pretty long text that i cant post since it exceeds length limit,after I plugged in the uno but got no new text on the terminal whatsover

Then your Uno is not responding via USB.

Either your Arduino Uno is dead, or the cable you use is broken, or your USB port is broken.

Is it a clone board with a micro-USB cable? Some cable are only for charging, not for data. Try a different cable.

I used to use the cable normally and it would upload code I remember on windows I used to have this error but it would go away,concerning the board LEDs lights up
also I tried a printer cable similar to the original cable but it too didnt seem to do much

As @maxgerhardt mentioned, it’s looking like your Uno is not connected to your PC which could be the cable. You mention that sometimes it didn’t work on Windows, but sometimes did. I’m wondering if your cable is faulty with a broken connection?

If you still have the arduino IDE installed, does your code upload there, using the same cable?

If you intend to buy a new one, make sure you get a power and data cable! Many of the ones you can buy these days, especially the cheap ones, are power only for charging phones etc. If you have a phone and it supplied a cable, try that as that should be power and data.

Cheers,
Norm.

I reinstalled the ide but the problem is still there
I do not know whether the cable is faulty or not as it used to work,but this might be the issue or maybe the cable just stopped working,
I will eventually get a new one and pat attention to the cable
Thanks

1 Like

I have some news,I bought another board with its cable and it worked fine,turns out the problems had to do with the old board ,I do not know what happened to it but anyway the new one is working fine

1 Like