LJC18A3-B-Z/BY Sensor analogRead values

I have a Capacitive Proximity Sensor LJC18A3-B-Z/BY, which I believe can detect many materials and send different values for each. I use 'analogRead()' to observe various values for each material, but I only receive 0 and 1023.

int sensorPin = A0;
int sensorVal;

void setup() {
  pinMode(sensorPin, INPUT);
  Serial.begin(9600);
}

void loop() {
  sensorVal = analogRead(sensorPin);
  Serial.println(sensorVal);
  delay(500);
}

No, it's either LOW or HIGH that why you see 0 and 1023.

NOTE: If you are supplying the sensor with more than 5V, disconnect it right away, you are damaging your Arduino.

Either low or high? I have a friend who has the same sensor as mine, but his sensor reads different values for different materials, such as plastic for 400-500. Is it possible to accomplish the same thing?

The exact same part number?
The one you have is a PNP output and it will either output the supply voltage or be an open circuirt

Do you have the datasheet for your sensor?

Even if I use npn, the output is either low or high, right?

I have asked the shop for it

Yes.

Both the NPN and PNP type are just switches, that close/open when it detects something.

I'll ask my friend how he got the values, as the LJC18A3-B-Z/BY are just some switches. Is it possible that he have the modified LJC18A3-B-Z/BY?

It's possible.

Your friend may have connected it incorrectly (did not connect the ground, causing other electric fields to imitate readings) or fabricated the readings because they have yet to do their work. You have the correct information now, and the understanding why. Proceed with your work.

I'm just asking my friend if he has a different sensor or modified one

Since I don't think that one could easily be modified it's probably a different sensor.

I have no other inquiries, so thank youu

Why don't tell us what you are trying to do and maybe someone here has a solution to your problem using different sensors.

Basically, I'm making a reverse vending machine or a recyclable bottle that is put as payment and fills a user-provided bottle with selectable water amount.

I think I'm good, i just spent ₱350 ($6.32) on that sensor (in my country ₱350 is expensive to us)

I'm in the U.S. and that is also expensive here