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.