ARDUINO-UNO : An error occurred while uploading the sketch

const byte outPin_CamShaft = 13;
const byte outPin_CrankShaft = 12;
const byte interruptPin = 2;
const byte PWM_Pin_slow = 5;
const byte PWM_Pin_fast = 9;
int counter_Crk = 0;
int counter_Cam = 0;
boolean state_Crk = LOW;
boolean state_Cam = LOW;
const int Mult = 1;

void setup() {
//Serielle Kommunikation starten
//Serial.begin(115200);

//PWM Frequenz für Pin D9 & D10 auf 3921.16 Hz setzen (entspricht etwa 4000 U/min)
TCCR1B = TCCR1B & B11111000 | B00000010;
//zum Test sehr kleine Frequenz für Pin D9 & D10 (30 Hz, kleiner geht nicht)
//TCCR1B = TCCR1B & B11111000 | B00000101;
//PWM Frequenz für Pin D5 & D6 auf 976,56 Hz setzen (entspricht etwa 1000 U/min)
TCCR0B = TCCR0B & B11111000 | B00000011;

pinMode(outPin_CamShaft, OUTPUT);
pinMode(outPin_CrankShaft, OUTPUT);
pinMode(PWM_Pin_slow, OUTPUT);
analogWrite(PWM_Pin_slow,127);
pinMode(PWM_Pin_fast, OUTPUT);
analogWrite(PWM_Pin_fast,127);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), rpm_signal, CHANGE);
Serial.println(“Init okay”);
}

void loop() {
// put your main code here, to run repeatedly:
}

//interrupt routine
void rpm_signal() {
//counter inkrementieren
counter_Crk++;
counter_Cam++;
/* Ausgabe zu Testzwecken
Serial.print(counter_Crk);
Serial.print(" ");
Serial.println(counter_Cam);
/
//Generierung Kurbelwellengebersignal
if (counter_Crk <= 116
Mult)
{
state_Crk = digitalRead(interruptPin);
}
else
{
state_Crk = LOW;
}
//Rücksetzen des Flankenzählers Kurbelwelle
if (counter_Crk >= 120*Mult)
{
counter_Crk = 0;
}
digitalWrite(outPin_CrankShaft, state_Crk);

//Generierung Nockenwellengebersignal
if ((counter_Cam > 100Mult) && (counter_Cam < 140Mult))
{
state_Cam = HIGH;
}
else
{
state_Cam = LOW;
}
//Rücksetzen des Flankenzählers Nockenwelle
if (counter_Cam >= 240*Mult)
{
counter_Cam = 0;
}
digitalWrite(outPin_CamShaft, state_Cam);

}

the above is the code I tried to upload in the Arduino, but it shows the below error,

Sketch uses 2,342 bytes (7%) of program storage space. Maximum is 32,256 bytes.
Global variables use 206 bytes (10%) of dynamic memory, leaving 1,842 bytes for local variables. Maximum is 2,048 bytes.
java.io.IOException: Cannot run program “{runtime.tools.avrdude.path}/bin/avrdude”: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26)
at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:130)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:209)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
at processing.app.Sketch.upload(Sketch.java:1187)
at processing.app.Sketch.exportApplet(Sketch.java:1160)
at processing.app.Sketch.exportApplet(Sketch.java:1132)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2409)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
… 9 more
An error occurred while uploading the sketch

The com port, driver every thing is working fine.
Your inputs would be helpful.
Thanks in advance.

java.io.IOException: Cannot run program “{runtime.tools.avrdude.path}/bin/avrdude”: CreateProcess error=2, The system cannot find the file specified

Do you actually have AVRdude installed?

Hello,
Thanks for the immediate support.I am not aware of what "AVRdude" is !
I am a beginner.
Your inputs will really help me.

AVRDUDE - AVR Downloader Uploader - is a program for downloading and uploading the on-chip memories of Atmel’s AVR microcontrollers. It can program the Flash and EEPROM, and where supported by the serial programming protocol, it can program fuse and lock bits. AVRDUDE also supplies a direct instruction mode allowing one to issue any programming instruction to the AVR chip regardless of whether AVRDUDE implements that specific feature of a particular chip.

It is essential to write the microcontroller. Usually it should be installed already but you can download it aswell.

I tried uploading it on my nano and it worked fine.

Best regards
MajorProb

PS: if you contact me in pm I'm german aswell :wink:

Hi,

AVRDUDE is installed with the Arduino IDE. Perhaps a fresh install of the IDE will resolve your problem.

best,
Michael