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

//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);
pinMode(PWM_Pin_fast, OUTPUT);
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
/* Ausgabe zu Testzwecken
Serial.print(" ");
//Generierung Kurbelwellengebersignal
if (counter_Crk <= 116
state_Crk = digitalRead(interruptPin);
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;
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. Cannot run program “{}/bin/avrdude”: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(
at cc.arduino.packages.Uploader.executeUploadCommand(
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(
at cc.arduino.UploaderUtils.upload(
Caused by: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(
at java.lang.ProcessImpl.start(
at java.lang.ProcessBuilder.start(
… 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. Cannot run program “{}/bin/avrdude”: CreateProcess error=2, The system cannot find the file specified

Do you actually have AVRdude installed?

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

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


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