Error: No connection established Compilation error: No connection established

I am new to arduino's!!!
Help please!!!

int enA =9;
int in1=8;
int in2=7;

void setup() {
  // put your setup code here, to run once:
pinMode(enA,OUTPUT);
pinMode(in1,OUTPUT);
pinMode(in2,OUTPUT);

digitalWrite(in1,LOW);
digitalWrite(in2,LOW);

}

void loop() {
  // put your main code here, to run repeatedly:
  directionControl();
  delay(1000);
  speedControl();
  delay(1000);
  

}
void directionControl()
{
  analogWrite(enA,255);

  digitalWrite(in1,LOW);
  digitalWrite(in2,HIGH);
  delay(2000);

  digitalWrite(in1,LOW);
  digitalWrite(in2,LOW);
}

void speedControl()
{
  digitalWrite(in1,LOW);
  digitalWrite(in2,HIGH);

  for(int i=0;i<256;i++)
  {
    analogWrite(enA,i);
    delay(20);
  }

  for(int i=255;i>0i--)
  {
    analogWrite(enA,i);
    delay(20);
  }
  digitalWrite(in1,LOW);
  digitalWrite(in2,LOW);
}```

I am hoping its just something stupid I have done, thank you everyone who helps!!!

Please show the error message in full

Welcome to the forum!

There is an error in the above for loop code. Although it would generate a compile error, I wouldn't expect the above error message. Further details of the error and more information would indeed help. For example, the screenshot looks like IDE v2.x.x, but which board are you using, is it connected to the USB port, and have you selected the correct board library and serial port?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.