How to program e18-d80nk x3 counter and display to lcd i2c

hi everybody
can you help me, I'm making a project using e18-d80nk x3, but when one of them is detecting an object, the other sensor can't detect it, can you give me some input.

this is my program...

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define counter_pin 2                                   // Set Pin

LiquidCrystal_I2C lcd(0x27,16,2);                       // Alamat LCD
bool item_detected = false;                             
int  item_counter = 0;
void setup()

{

  Serial.begin(9600);
  pinMode( counter_pin , INPUT);
  lcd.begin();                                          // Start LCD
  
  // Print a message to the LCD.
  lcd.setCursor(0,0);                                   // Baris Atas
  lcd.print("PERSIAPAN");
  lcd.setCursor(2,1);                                   // Baris Bawah
  lcd.print("PERHITUNGAN:)");
  delay(3000);                      
}

// Sub Counter Pembaharuan Jumlah
void loop()
{
  int val = digitalRead( counter_pin );
  if( (item_detected == false) && ( val == 0 )){
        item_detected = true;
        item_counter++;
        updateCounter();
  }
  else if( (item_detected == true) && ( val == 1 )){
        item_detected = false;
  }
}
// Katerangan Jumlah Hitung Pada Antarmuka LCD
void updateCounter(){
     lcd.clear();
     lcd.setCursor(0,0);
     lcd.print("JUMLAH BENIH");
     lcd.setCursor(0,1);
     lcd.print(item_counter);
}

Here’s the sensor..
IR proximity sensor

Can you please edit your post, and put the code inside ‘code tags’ as suggested in the forum guidelines.

Your code currently uses one sensor but… you could create three sensors, or an array of sensors, but until you do, sensor 2 and sensor 3 won’t help much.

No, but you can pay us to do it for you…
There’s a specific forum section for paid projects.

To get going, please reformat your existing post WITH CODE TAGS, because if you can’t read or understand instructions, there’s little point in teaching you how to write code.

ok,thanks for ur time

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