Error whilst compiling sketch for my board. Not an IDE issue.

I am trying to upload a test program to my board to ensure that my motion sensor works.
These are the error messages.

Arduino: 1.8.1 (Windows 8.1), Board: "Arduino Duemilanove or Diecimila, ATmega328"

In file included from sketch\motion_sensor_test.ino.cpp:1:0:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:41:14: error: expected unqualified-id before numeric constant

 #define LOW  0x0

              ^

C:\Users\DaveandLynne\Documents\Joe\College yr 2\JOE COLLEGE (THIS ONE)\Code\motion_sensor_test\motion_sensor_test.ino:15:15: note: in expansion of macro 'LOW'

 int ledState; LOW

               ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:41:14: error: expected unqualified-id before numeric constant

 #define LOW  0x0

              ^

C:\Users\DaveandLynne\Documents\Joe\College yr 2\JOE COLLEGE (THIS ONE)\Code\motion_sensor_test\motion_sensor_test.ino:21:13: note: in expansion of macro 'LOW'

 int motion; LOW

             ^

exit status 1
Error compiling for board Arduino Duemilanove or Diecimila.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

And this is my code. See below for explanation of function.

[code]
#include <LiquidCrystal.h>

#include <SoftwareSerial.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

unsigned long time; 

int counter2 = 0;
int currentState2 = 0;
int previousState2 = 0;

const int led = 13; 

int ledState; LOW



const int motion = 6; 

int motion; LOW


void setup() {
  Serial.begin(9600);//serial comms between arduino and computer
 
  pinMode (led, OUTPUT);
  pinMode (motion, INPUT);
 
  digitalWrite(led, LOW);
  lcd.begin(16, 2);
  
}

void loop(){

{
    Serial.print("Time: ");
    time = millis();
    lcd.setCursor(1, 0);
    lcd.print(time);
    delay(1000);
  }

{

  digitalRead (motion);
  if (motion, HIGH)
  {
    digitalWrite (led, HIGH);
    delay (8000);
    digitalWrite (led, LOW);
    currentState2 = 1;
  }
  else
  {
    digitalWrite (led, LOW); //PIR sensor (inside to outside) part
    currentState2 = 0;
  }
  if(currentState2 != previousState2)
{
  if (currentState2 == 1)
  {
    counter2 = counter2 + 1;
    lcd.setCursor(0, 8);
    lcd.print(counter2);
  }
}
previousState2 = currentState2;
delay(250);
  }
  
}

[/code]

I also have an LCD screen connected which I have already tested and I know that part of the code works. My motion sensor will (when completed) operate a motor when motion is detected. For the purpose of the test program, I have replaced the motor with the on-board LED. I have tried to implement a counter circuit which counts the number of times the motor/led has been set to HIGH. It is meant to send this number to the LCD screen. I also have tried to get another counter to count how long the program has been running and send that to a different row on the LCD. I am a beginner to arduino and not entirely sure how it all works, so a lot of the project so far has been trial and error.

Please would somebody find the problem with my code? I have uploaded an empty sketch and other sketches to the board absolutely fine without having this issue at all so I know its not an issue with my version of Arduino.

int ledState; LOW
int motion; LOW

What are you trying to do here :wink:

Especially knowing the macro will just be expanded / copy-pasted so the compiler will see

int ledState; 0x0
int motion; 0x0

Okay, so i'm not sure if thats the correct thing to do but I was trying to set them as variables that could be changed... so the LED can be high/low and the motion sensor can be high/low. Do you see what I mean?

Anyway, I deleted them off the program and I managed to compile it, so maybe I came looking for help too soon haha.

So you want to define a variable an initialize it to LOW? Then use the syntax to assign a value :wink: A ; indicates the end of a statement. Aka, nothing after a ; has anything to do with before it unless you explicitly call it to (for example, use the same variable).

So try:

int ledState = LOW;
int motion = LOW;

Or better:

bool motion = false;

And just read the led state with digitalRead() :wink: