Not sure how to fix error in code

I'm trying to write a code that will print a readout of how many customers pass through a door in a minute, I have it mostly down I think but i'm getting an error that says "expected primary expression before '>' token. I'm very new to this and don't have much experience in coding so go easy on me. I'll paste my code below.

int ledPin = 13;                // LED connected to digital pin 13
int photoPin = 2;               //
int val = 0;
int valold = 0;
int start;
unsigned int count = 0;

void setup()                    // run once, when the sketch starts
{
pinMode(ledPin, OUTPUT);      // sets the digital pin as output
pinMode(photoPin, INPUT);  
valold = digitalRead(photoPin);
Serial.begin(9600);
}

void loop()                     // run over and over again
{
start = millis(); // take the start time
count = 0; // reset couter
// do the following loop for 60000ms = 1min
while (millis()-start < 60000)
{
   // check for overflow of millis()
   if (start > millis() 
)    {
     start = millis();
     count = 0;
   }
  val = digitalRead(photoPin);
  if (val==LOW)
  {
    digitalWrite(ledPin, LOW);
  }
  else
  {
    digitalWrite(ledPin, HIGH);
    if (val <> valold) {
      count ++;
      valold = val;
    }
  }
}
// 1 minute over. print conts
Serial.print("Customers per minute: ");
Serial.println(count,DEC);
}

It would have helped if you did read How to use the forum as suggested. That would have told you to post to use code tags AND to post the complete error code. Because, surprise! It does contain more info :wink: Like, where the error is.

     if (val <> valold) {

Oops. Inequality has a different notation in C++.

     if (val != valold) {

Code works now but i'm just getting a printout that says " customers per minute : 0 " doesn't seem to count up at all even though i'm waiving in front of the sensor and the led is going on and off.

@moderator, I think we can lock this thread. OP isn't really interested in reading it anyway. ::slight_smile:

Aka, please read above posts again and ACT on it please.

int ledPin = 13;                // LED connected to digital pin 13
int photoPin = 2;               //
int val = 0;
int valold = 0;
int start;
unsigned int count = 0;

void setup()                    // run once, when the sketch starts
{
 pinMode(ledPin, OUTPUT);      // sets the digital pin as output
 pinMode(photoPin, INPUT);  
 valold = digitalRead(photoPin);
 Serial.begin(9600);
}

void loop()                     // run over and over again
{
 start = millis(); // take the start time
 count = 0; // reset couter
 // do the following loop for 60000ms = 1min
 while (millis()-start < 60000)
 {
    // check for overflow of millis()
    if (start > millis() 
)    {
      start = millis();
      count = 0;
    }
   val = digitalRead(photoPin);
   if (val==LOW)
   {
     digitalWrite(ledPin, LOW);
   }
   else
   {
     digitalWrite(ledPin, HIGH);
     if (val != valold) {
       count ++;
       valold = val;
     }
   }
 }
 // 1 minute over. print conts
 Serial.print("Customers per minute: ");
 Serial.println(count,DEC);
}

Here is my updated code, Code seems to work now but i'm just getting a printout that says " customers per minute : 0 " doesn't seem to count up at all even though i'm waiving in front of the sensor and the led is going on and off.

You have a Serial.begin() statement. That's good.

That means that you can print other things to tell you what your code is doing. So, why don't you?

    if (start > millis()
)    {

What the hell is that paren doing THERE? It belongs on the end of the if statement.

What is connected to the photoPin? How?

PaulS:
You have a Serial.begin() statement. That's good.

That means that you can print other things to tell you what your code is doing. So, why don't you?

    if (start > millis()

)    {



What the hell is that paren doing THERE? It belongs on the end of the if statement.

What is connected to the photoPin? How?

I have a photoelectric beam sensor with the common wire connected to pin 2 and the normally closed section of the relay connected to the negative pin.

Do you think that the program might work better if the start variable was able to hold a value greater than 32767 ?

I have a photoelectric beam sensor with the common wire connected to pin 2 and the normally closed section of the relay connected to the negative pin.

What pulls pin 2 high when the relay opens? Hint: pin 2 has an internal pullup resistor that is enabled by

pinMode(pin, INPUT_PULLUP);