arduino mega 2560 using sketch: error message serial port does not exist

Ok so I made sure that my serial ports match. I have the actual arduino board not one from chin.

Im using sketch and I have a program that I know is a good program and even checked it on the sketch.shows no problems or issues. I’m using this board to make my christmas lights switch come on and off to the beat of music so thank god I started this now. I have all my electrical outlets made this was my last step before downloading vixen. Any help is greatly appreciated.

By the way I just got on the forum 4/5/18

The program I have

#define MEGA_VIXEN
//#define UNO_VIXEN

#ifdef MEGA_VIXEN
#define MAX_CHANNELS 48
int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53};
#endif

#ifdef UNO_VIXEN
#define MAX_CHANNELS 18
int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,A0,A1,A2,A3,A4,A5};
#endif

int incomingByte[MAX_CHANNELS];

void setup()
{
int i;

Serial.begin(9600); // set up Serial at 9600 bps

for ( i = 0; i < MAX_CHANNELS; i ++ ) pinMode(channels*, OUTPUT);*
}
void loop()
{

  • int i;*

  • if (Serial.available() >= MAX_CHANNELS)*

  • {*
    for (i=0; i < MAX_CHANNELS; i ++) incomingByte = Serial.read();
    * }*
    for (i = 0; i < MAX_CHANNELS; i ++ ) analogWrite(channels_, incomingByte*);
    }*_

Christmas? Show us your code, error messages and any wiring diagrams you think might be important, and read the guides at the top of the first page regarding posting on this forum - save yourself some agro.

Possibly change your for loops to start at 2, not 0.

the arduino isnt hooked up to the lights yet you have to use this program before this happens. thank you Ill try changing that coding but when you test the program on itself it works. there is numerous people already using this coding the error reads in this manner."the selected serial port does not exist or your board is not connected".

the error reads in this manner.

Nonsense. The COMPLETE error message tells you (or us) which file is being compiled and which line is causing the problem.

If you enable verbose mode, it will even tell you (or us) which Arduino you are compiling for, and what version of the IDE, since you omitted some of those details, along with the code tags you were supposed to use.

ok im sorry I’m new at this what is verbose mode and how do I run that

my complete error message

Arduino: 1.8.5 (Windows Vista), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Sketch uses 2956 bytes (1%) of program storage space. Maximum is 253952 bytes.
Global variables use 376 bytes (4%) of dynamic memory, leaving 7816 bytes for local variables. Maximum is 8192 bytes.
avrdude: ser_open(): can't open device "\.\COM1": The system cannot find the file specified.

avrdude: ser_drain(): read error: The handle is invalid.

avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

the selected serial port
does not exist or your board is not connected
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.

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

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

That has NOTHING to do with the code failing to compile. It DID compile and link. It failed to upload is all. Have you ever been able to upload a sketch?

Have you ever been able to upload a sketch using COM1? NONE of my Arduinos ever uses COM1.

when I went to look at the port its on com2 is this an issue

Go into your device manager and see what com port your Arduino board is showing up on and match that in IDE.

when I went to look at the port its on com2 is this an issue

Not for me. Obviously it is for you. In the Tools + Port menu, select the port that the Arduino is actually connected to.