Running Flow Meter sketch on Raspberry pi

I am using the following code on windows 10 which works ok. What do I have to do to get it to work on a raspberry pi which uses an older version of IDE

#include <Wire.h>

#include <LiquidCrystal_I2C.h>


// Set the LCD address to 0x3F for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x3F, 16, 2);
 const byte statusLed = 13;
const byte sensorPin = 2;

// The hall-effect flow sensor outputs approximately 4.5 pulses per second per litre/minute of flow.
const float calibrationFactor = 2.9;
volatile uint16_t pulseCount;

float flowRate;
float flowLitres;
float totalLitres;

unsigned long oldTime;
const unsigned long sampleDuration = 1000ul;


// ISR
void pulseCounterISR()
{
  pulseCount++;  // Increment the pulse counter
}
void setup()
{
  
  // Initialize a serial connection for reporting values to the host
  Serial.begin(115200);

  // Set up the status LED line as an output
  pinMode(statusLed, OUTPUT);
  digitalWrite(statusLed, HIGH);  // We have an active-low LED attached

  pinMode(sensorPin, INPUT_PULLUP);

  pulseCount = 0;
  flowRate = 0;
  flowLitres = 0;
  totalLitres = 0;
  oldTime = millis();

  // The Hall-effect sensor is connected to pin 2 which uses interrupt 0.
  // Configured to trigger on a FALLING state change (transition from HIGH
  // state to LOW state)
 
  // initialize the LCD
  lcd.begin();

  // Turn on the blacklight
  lcd.setBacklight((uint8_t)1);

  // First row
  lcd.print("L/min:");

  // Second row
  lcd.setCursor(0,1);
  lcd.print("Total:");
}

void loop()
{
   unsigned long chrono = millis();

  if ((chrono - oldTime) >= sampleDuration)   // Only process counters once per sampleDuration
  {
    // Disconnect the interrupt ISR while calculating flow rate and sending the value to the host
    detachInterrupt(digitalPinToInterrupt(sensorPin));

    // if we have calibrationFactor pulses then we have 1 l/minute
    flowRate = (pulseCount / calibrationFactor) ; // this is in l/min

    // Because this loop may not complete in exactly sampleDuration intervals we calculate
    // the number of milliseconds that have passed since the last execution and use
    // that to scale the output.
    flowRate *= (((float) sampleDuration) / (chrono - oldTime)) ; // this is in l/min

    // Divide the flow rate in litres/minute by 60 to determine how many litres have
    // passed through the sensor in 1s and multiply by number of second of sampling
    flowLitres = (flowRate / 60.0) * (sampleDuration / 1000.0);

    // Add the litres we measured to the cumulative total
    totalLitres += flowLitres;

   

    // Print the flow rate for this second in litres / minute
    lcd.setCursor(8,0);
    lcd.print(flowRate/10);

   // Print the cumulative total of litres flowed since starting
    lcd.setCursor(8,1);
    lcd.print(totalLitres/10);

    pulseCount = 0; // Reset the pulse counter so we can start incrementing again
    oldTime = millis(); // Note the time this processing pass was executed.

    // Enable the interrupt ISR again now that we've finished sending output
    attachInterrupt(digitalPinToInterrupt(sensorPin), pulseCounterISR, FALLING);
}
}

I assume you're talking about compiling. So what goes wrong?

Or do you want to port the code to run on the Pi (lcd connected to Pi, sensors connected to Pi etc)?

The Raspberry Pi can run the latest version of the Arduino IDE. You just need to download the "Linux ARM" version of the official Arduino IDE, which you can get free here:

Don't even use a package manager (e.g. apt-get install arduino) to install Arduino because that will cause you to get a very outdated and non-standard version of the IDE which will cause you all kinds of problems.

Thanks a lot I did not know you could get the full version for raspberry pi

I'm even running it even on the RPi Zero.

Tried it on the Rpi zero. Worked first time and running no problems