Arduino IDE 1.8.2 Failed to Open any Arduino Files

Hello Friends,

I am using an Arduino Mega2560 r3, an L293D IC and a power supply module to run a DC motor. As instructed by the "most complete starter kit" eBook, I looked to my code folder for lesson 29, DC motors, and found an arduino file, as anticipated.

When i open the file with Arduino IDE 1.8.2, I get a error message saying Arduino IDE Failed to open, so I downloaded Developer Virtuoso, and I get the code below in text.

When I upload this sketch, my DC motor spins anti-clockwise, pauses, repeats (also anti-clockwise) 4 more times, then there's a bigger delay, then it spins at a constant speed (still anti-clockwise) for a few seconds, then about a 10 second pause, repeat.

I can tell the code, although i didn't write it, would tell the motor to switch directions back and forth for a bit, to speed up and slow down, than show varying speeds in descending order.

Yet my DC motor shows no variety in speed or direction.

I know it's wired correctly, many different tripple checks, it is a match for what the lesson says and depicts, and what my training with IC's thinks it should be

My question is for what reason would Arduino IDE 1.8.2 not be able to open arduino files provided in the "most complete starter kit" when they could be accessed by Developer Virtuoso; and/or does the code below achieve what in its own footnotes claim to.

None of the code I downloaded from Elegoo in "arduino file" format can be opened by Arduino IDE 1.8.2, although it works great uploading sketches to my arduino mega; I've even reinstalled to no avail.

Will every code provided by Elegoo and opened not with Arduino IDE be corrupted?

Basically if this code below is valid, theres something wrong with my motor

//www.elegoo.com
//2016.12.12

/************************
Exercise the motor using
the L293D chip
************************/

#define ENABLE 5
#define DIRA 3
#define DIRB 4

int i;

void setup() {
//---set pin direction
pinMode(ENABLE,OUTPUT);
pinMode(DIRA,OUTPUT);
pinMode(DIRB,OUTPUT);
Serial.begin(9600);
}

void loop() {
//---back and forth example
Serial.println("One way, then reverse");
digitalWrite(ENABLE,HIGH); // enable on
for (i=0;i<5;i++) {
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(500);
digitalWrite(DIRA,LOW); //reverse
digitalWrite(DIRB,HIGH);
delay(500);
}
digitalWrite(ENABLE,LOW); // disable
delay(2000);

Serial.println("fast Slow example");
//---fast/slow stop example
digitalWrite(ENABLE,HIGH); //enable on
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(3000);
digitalWrite(ENABLE,LOW); //slow stop
delay(1000);
digitalWrite(ENABLE,HIGH); //enable on
digitalWrite(DIRA,LOW); //one way
digitalWrite(DIRB,HIGH);
delay(3000);
digitalWrite(DIRA,LOW); //fast stop
delay(2000);

Serial.println("PWM full then slow");
//---PWM example, full speed then slow
analogWrite(ENABLE,255); //enable on
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(2000);
analogWrite(ENABLE,180); //half speed
delay(2000);
analogWrite(ENABLE,128); //half speed
delay(2000);
analogWrite(ENABLE,50); //half speed
delay(2000);
analogWrite(ENABLE,128); //half speed
delay(2000);
analogWrite(ENABLE,180); //half speed
delay(2000);
analogWrite(ENABLE,255); //half speed
delay(2000);
digitalWrite(ENABLE,LOW); //all done
delay(10000);
}

Ultimate project is to use a motion sensor to turn on a fan for about a minute, then the fan turns off until prompted again.

Thanks much if you suffer through reading this all

-Chris

I'm a bit confused by your title. Are you saying you cannot open any .INO file, not even the example programs that come with the Arduino IDE?

Or are you saying that you can open the example files but you cannot open some file that you downloaded from somewhere?

What operating system is on your PC?

...R

camanbass's GitHub issue: IDE Failed to Open Arduino File/DC Motors · Issue #6322 · arduino/Arduino · GitHub

camandbass:
When i open the file with Arduino IDE 1.8.2, I get a error message saying Arduino IDE Failed to open

Please write the exact error message.

whats with the scrolling text box at the top

GitHub issue reports are interpreted as Markdown. Markdown puts any text that is indented by four spaces or more in a code box. So ironically your text, that should not be, is in a code box but your code, which should be, is not in a code box. Please spend a little time learning the basics of Markdown before creating any other issues on GitHub:

At this point I think discussion of this is more appropriate here on the forum and you will get helped faster. So please don't post any more to GitHub until we have determined if this is caused by user error or an actual unreported bug in the IDE. Hundreds of people get an email every time you comment on GitHub.

Built in sketches will load, but if i choose ANY .ino files from file explorer, (the sketches the go along w/the lesson book) Arduino IDE gives me

warning

Failed to open sketch: "C:\users\user\desktop\arduino\2650??170509\english\code\Lesson 29 DC Motors\DC_Motor\DC_Motor.ino"

or the path to whichever .ino files

they will open with other software

Windows10

What happens if you open the Arduino IDE and then open the sketch via the File > Open menu?

camandbass:
Failed to open sketch: "C:\users\user\desktop\arduino*2650??170509*\english\code\Lesson 29 DC Motors\DC_Motor\DC_Motor.ino"

What's that red part? Whatever it is, see what happens if you rename it.

camandbass:
Built in sketches will load, but if i choose ANY .ino files from file explorer, (the sketches the go along w/the lesson book) Arduino IDE gives me

warning

Failed to open sketch: "C:\users\user\desktop\arduino\2650??170509\english\code\Lesson 29 DC Motors\DC_Motor\DC_Motor.ino"

or the path to whichever .ino files

they will open with other software

That sounds like the Arduino IDE is running as a "user" that does not have the rights to open those files. However I don't know enough about Windows to know if that is likely.

Have you tried deleting and re-installing the Arduino IDE

...R

Possibly a character code issue in the path. If I'm not mistaken, ? is a wildcard for search and an invalid character on pathnames.

As oqibidipo said, try to rename that specific part.

Hey everybody!

Pert saved me, i feel so idiotic never attempting to open the files through file > open

My motor changes speed and direction with the new code and im quite thankful!

I'll be taking a while to understand how the new code differs from the one in my original post ^

I'll also take into account the name of the file with the ??? and see if that can fix the issue, making it easier for me to find and open .ino files from file explorer

Thanks again

On to my project of a motion sensor activated fan!

If you have any ideas how that code could be achieved I'd love to hear from you!

-Chris

I'm glad to hear that it's working! I do think that you should be able to open .ino files in the Arduino IDE just by clicking on the file, rather than using File > Open. It may well be that there were some characters in the folder name that the Arduino IDE didn't like. If you can isolate the problem to this and other common programs don't have the issue opening the file by double clicking it then it would be reasonable to continue your issue report on GitHub to see if the Arduino developers can fix this problem. At least you will have been able to explain exactly the problem to them. Often it is the initial troubleshooting that is the most time consuming and actually fixing a bug once the cause is determined is very fast and easy. I don't know enough about your issue or the inner workings of the Arduino IDE to say for sure though.

The only problem I have with opening .ino files by double clicking them is that I have multiple versions of the Arduino IDE on my computer but the one I actually went through the Windows installation process with is an older version and that version of the IDE is the one that opens when I double click a .ino file, so it's not a useful thing for me. I keep all my sketches under my sketchbook folder, which makes it easy to load them from the File > Sketchbook menu.