void declaration error I am new to Arduino and C++ and I was practicing with a traffic light project.
This is my code:
int red = 10;
int yellow = 9;
int green = 8;

void setup() {
  pinMode(red,OUTPUT);
  pinMode(yellow,OUTPUT);
  pinMode(green,OUTPUT);
}

void loop() {
  changelights();
  delay (15000);
}

void changelights{
  // 1st action: green off to yellow
  digitalWrite(green, LOW);
  digitalWrite(yellow, HIGH);
  delay (3000)
  // 2nd action: tellow to red 
  digitalWrite(yellow, LOW);
  digitalWrite(red, HIGH);
  //3rd action: caution light 
  digitalWrite(yellow, HIGH);
  delay (3000)
  //4th action: caution to go 
  digitalWrite(red,LOW);
  digitalWrite(yellow, LOW);
  digitalWrite(green, HIGH);
}

I tried compiling it and returned an error message that said that I did not declare my &quot;changelights&quot; function. What should I do to fix this?
Thank you very much
You forgot to put the parenthenses () after the name of the function changelights. They are there to declare variables you can use later in the code like that:
void function(int a){
  a+=1;
  return a;
}

To fix your error just change
void changelights{

to
void changelights(){

Keep in mind if you want to program C++ (which would be Off-Topic here, but you mentioned it in your question) you have to declare the function in the beginning or mention it.