0

I am working on some arduino code and my program keeps on giving me this error,

ISO C++ forbids comparison between pointer and integer [-fpermissive] 

I've tried searching on the internet to solve this issue but, either the solution is incorrect, or irrelevant. here is where the arduino software is saying the problem is,

if((millis - incLastDebounce) > debounceDelay) {

and if you need the rest of the code here it is,

#include <LiquidCrystal.h>

int freq = 0;
int change = 0;
const int incPin = 3;
const int setPin = 2;
int incButtonState;
int setButtonState;
int incPreviousState;
int setPreviousState;
int incLastDebounce;
int setLastDebounce;
const int debounceDelay = 50;


LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
  // put your setup code here, to run once:
lcd.begin(16, 2);
pinMode(setPin, INPUT);
pinMode(incPin, INPUT);
lcd.print("Frequency: " + freq);
}

void loop() {
  // put your main code here, to run repeatedly:
int incReading = digitalRead(incPin);
int setReading = digitalRead(setPin);

if(setReading != setPreviousState) {
  setLastDebounce = millis();
}
if(incReading != incPreviousState) {
  incLastDebounce = millis();
}

if((millis - setLastDebounce) > debounceDelay) {

  if(setReading != setButtonState) {
    setButtonState = setReading;
  }
  if(setButtonState == HIGH) {
    //Okay so here you will do your set lcd voodoo
  }
}

if((millis - incLastDebounce) > debounceDelay) {
  if(incReading != buttonState) {
    incButtonState = incReading;
  }
    if(buttonState == HIGH) {
      // here you can put the lcd code
      change = change + 500;
      if(change == 10500){
        change = 0;
       }
    }

  }


incPreviousState = incReading;
setPreviousState = setReading;
}

hopefully you can find the problem and help.

1 Answer 1

2

Looks like you're missing parentheses after millis, so instead of calling the function, you're trying to do arithmetic with its memory address.

This will probably work better:

if ((millis() - incLastDebounce) > debounceDelay) {
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.