Skip to main content
Post Closed as "Not suitable for this site" by Juraj, sempaiscuba, Greenonline, gre_gor, per1234
Formatting and title more descriptive and less vague
Source Link
Greenonline
  • 3.2k
  • 7
  • 37
  • 49

How to Fix Problem With Arduino Programfix "expected ; before ) token" error?

I am in the early stages of writing my program, but I have run into a problem. I am fairly new to arduinoArduino so i'mI'm not sure if there is something I am trying to do that doesn't work, but I am getting an error message "expected ; before ) token"

expected ; before ) token

on the line for(count <= 10)for(count <= 10).

I would really appreciate if someone could let me know why I am getting this error.

#include<EEPROM.h>
const int LED = 12;
const int SWITCH = 4;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  pinMode(LED, OUTPUT);           //LED is always outputting information
  pinMode(LED_BUILTIN, OUTPUT);   //Built in LED is always outputting information
  pinMode(SWITCH, INPUT_PULLUP);  //Switch inputs value when in/out of ground
}

void loop() {
  // put your main code here, to run repeatedly:
  int addr = 0;     //Declaring variables
  int count = 0;
  int seconds;

  if (digitalRead(SWITCH) == LOW) {
Serial.println("----Recording----");

    for (count <= 10) {
      while (digitalRead(SWITCH) == LOW) {
        count = count + 1;
        digitalWrite(LED, LOW);
        delay(50);
      }
      else {
        count = count + 1;
        digitalWrite(LED, HIGH);
        delay(50);
      }
    } else {
      digitalWrite(LED_BUILTIN, HIGH);        //Internal LED blinks
      delay (300);
      digitalWrite(LED_BUILTIN, LOW);
      delay(300);
    }
  }
}

How to Fix Problem With Arduino Program?

I am in the early stages of writing my program, but I have run into a problem. I am fairly new to arduino so i'm not sure if there is something I am trying to do that doesn't work, but I am getting an error message "expected ; before ) token" on the line for(count <= 10).

I would really appreciate if someone could let me know why I am getting this error.

#include<EEPROM.h>
const int LED = 12;
const int SWITCH = 4;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  pinMode(LED, OUTPUT);           //LED is always outputting information
  pinMode(LED_BUILTIN, OUTPUT);   //Built in LED is always outputting information
  pinMode(SWITCH, INPUT_PULLUP);  //Switch inputs value when in/out of ground
}

void loop() {
  // put your main code here, to run repeatedly:
  int addr = 0;     //Declaring variables
  int count = 0;
  int seconds;

  if (digitalRead(SWITCH) == LOW) {
Serial.println("----Recording----");

    for (count <= 10) {
      while (digitalRead(SWITCH) == LOW) {
        count = count + 1;
        digitalWrite(LED, LOW);
        delay(50);
      }
      else {
        count = count + 1;
        digitalWrite(LED, HIGH);
        delay(50);
      }
    } else {
      digitalWrite(LED_BUILTIN, HIGH);        //Internal LED blinks
      delay (300);
      digitalWrite(LED_BUILTIN, LOW);
      delay(300);
    }
  }
}

How to fix "expected ; before ) token" error?

I am in the early stages of writing my program, but I have run into a problem. I am fairly new to Arduino so I'm not sure if there is something I am trying to do that doesn't work, but I am getting an error message

expected ; before ) token

on the line for(count <= 10).

I would really appreciate if someone could let me know why I am getting this error.

#include<EEPROM.h>
const int LED = 12;
const int SWITCH = 4;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  pinMode(LED, OUTPUT);           //LED is always outputting information
  pinMode(LED_BUILTIN, OUTPUT);   //Built in LED is always outputting information
  pinMode(SWITCH, INPUT_PULLUP);  //Switch inputs value when in/out of ground
}

void loop() {
  // put your main code here, to run repeatedly:
  int addr = 0;     //Declaring variables
  int count = 0;
  int seconds;

  if (digitalRead(SWITCH) == LOW) {
Serial.println("----Recording----");

    for (count <= 10) {
      while (digitalRead(SWITCH) == LOW) {
        count = count + 1;
        digitalWrite(LED, LOW);
        delay(50);
      }
      else {
        count = count + 1;
        digitalWrite(LED, HIGH);
        delay(50);
      }
    } else {
      digitalWrite(LED_BUILTIN, HIGH);        //Internal LED blinks
      delay (300);
      digitalWrite(LED_BUILTIN, LOW);
      delay(300);
    }
  }
}
Source Link
Thomas
  • 1
  • 1
  • 1

How to Fix Problem With Arduino Program?

I am in the early stages of writing my program, but I have run into a problem. I am fairly new to arduino so i'm not sure if there is something I am trying to do that doesn't work, but I am getting an error message "expected ; before ) token" on the line for(count <= 10).

I would really appreciate if someone could let me know why I am getting this error.

#include<EEPROM.h>
const int LED = 12;
const int SWITCH = 4;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  pinMode(LED, OUTPUT);           //LED is always outputting information
  pinMode(LED_BUILTIN, OUTPUT);   //Built in LED is always outputting information
  pinMode(SWITCH, INPUT_PULLUP);  //Switch inputs value when in/out of ground
}

void loop() {
  // put your main code here, to run repeatedly:
  int addr = 0;     //Declaring variables
  int count = 0;
  int seconds;

  if (digitalRead(SWITCH) == LOW) {
Serial.println("----Recording----");

    for (count <= 10) {
      while (digitalRead(SWITCH) == LOW) {
        count = count + 1;
        digitalWrite(LED, LOW);
        delay(50);
      }
      else {
        count = count + 1;
        digitalWrite(LED, HIGH);
        delay(50);
      }
    } else {
      digitalWrite(LED_BUILTIN, HIGH);        //Internal LED blinks
      delay (300);
      digitalWrite(LED_BUILTIN, LOW);
      delay(300);
    }
  }
}