Unable to find numeric literal operator 'operator""pin'

Hi All.

I'm coding a program to gather the data of a flow sensor on my computer.

I have written the code for the Arduino to output from pin 2 and I get the error “unable to find numeric literal operator 'operator”"pin’

Am i doing something wrong?

Cheers,
Emile

int NbTopsFan;
int Calc;
int hallsensor = 2pin; //signal raccordé sur le pin digital 2

void rpm()  //fonction vide déclenchée à chaque interruption
{
  NbTopsFan++
}

void setup()
{
pinMode(hallsensor, INPUT);
Serial.begin(9600);
attachInterrupt(digitalPinToInterrupt(2pin), rpm, RISING);
}

void loop()
{
NbTopsFan = 0;
sei();
delay (1000);
cli();
Calc = (NbTopsFan * 7.5);
Serial.print (Calc, DEC);
Serial.prinln();
}

Just use 2 instead of 2pin.

Thank you very much :smiley:

Variable names cannot start with a digit

You can't have a name that starts with 2. You probably meant:
const int hallsensor = 2;

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.