Problem with Arduino Mega 2560 led 13 "L"and unable to upload

Hi everyone, i need a help!.

when i turn on the arduino the green led "on" it's work. and led of pin 13 "L" blinking but after that the light of "L" led become so low ( but when i press rest button is blinking by full light but after that light become low again )

  • pin 1 "tx" is \HIGH but Tx&RX led is off and all pins is low expect 5v pins , vin and 1 "tx"

when i upload a new code i got this message

the selected serial port does not exist or your board is not connected

avrdude: stk500v2_ReceiveMessage() : timeout
avrdude: stk500v2_getsync() : timeout communicating


whats happened

I want to control 18 servos (i making hexapod robot) but the board has 14 "I was thought it 15 i counted pin 13 as PWM" X_X ! . So i need 3 more ( remember i counted pin 13) so i wrote a sketch that define pins from 2 to 13 and 44,45 and 46 as PWM (by using Servo.h library) and i connected it with another Arduino (Uno) ( 40,41,42 as o/p on Mega with 2,4,8 as i/p on Uno ) as parallel 3-bit communication (by this way i can control other 3 on uno board by 8 state. ex 000=state_one, 001=state_two ..).
and i use bluetooth module to control the system by send "number" from android phone
each number symbolize a mode(state) on sketch (like 1=walking forward, 2=walking backward,..etc)
but i made also three pins (30,31,32) to control the system for testing if bluetooth isn't work
so i made pin 33 as switch when it's high "system work by the three pins" when it's low "system work by bluetooth"

i uploaded the sketch without problem but i forgot to define pin 33 as input. So i edited the code but when i try to upload it's failed

  • all this is a sketch i didn't connect any thing

Does the problem still occur if you have only the Mega connected to your computer, without any servos, Bluetooth, buttons, etc. connected to it?

i didn't connect any thing. I Just unplugged the USB and i remembered to define pin 33 so i plugged again to upload the code.

all i did say is in sketch code

is the board is damaged?

thank you for reply

Find in the sketch where you have !!! and remove those.

i didn't type or use !.

  • i known why the led "L" light becomes low >>> it is the PWM.
  • and i think the pin 0 and 1 are the reason!

Reference > Language > Functions > Communication > Serial

"On Uno, Nano, Mini, and Mega, pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board."

because i use pin 0 and 1 as serial communication for Bluetooth module

I'm right?

*I've connected the arduino to the circuit and it's work. but i still have the USB problem (i can't upload a new sketch)

thank you for replay

the sketch is the reason?
first part of the sketch :

    #include <Servo.h>
#include <SoftwareSerial.h>

//define three pins  for commenication between UNO and Mega to control RS1,RS2,RS3 
#define S0 30
#define S1 31
#define S2 32
#define rem0 40
#define rem1 41
#define rem2 42
#define oprem 43

SoftwareSerial Bluetooth(0, 1); // Arduino(RX, TX) - HC-06 Bluetooth (TX, RX)

// Create servo object
Servo LL1,LL2,LL3,LM1,LM2,LM3,LS1,LS2,LS3,RL1,RL2,RL3,RM1,RM2,RM3; //define variables for 15 servo in Arduino Mega 

int dataIn=0,m=0,st=0;

Can you upload the Blink sketch and verify it works, from the File, Examples, 01.Basics menu?

Oh guys thank you !
I solved the problem, even it's not a problem
I forgot to select the port of arduino mega. when I connect the uno is was already selected.... that's why
thank you Pert and Dmjlambert