Using Sharp GP2Y0D805Z0F digital sensors.

Hello all,

novice here.
my project involves using two sharp distance sensors to direct power to a larger system of attiny85's.

at first I thought it was the code which the community ensured me its not (at least it works i mean)

now I'm wondering if i'm even using these sensors correctly. if I wire them according to the specs, they arent working. Vin to +, gnd to ground, out, to the pin...which is the way I though it worked; but nothing. so I tried vin to +, out to ground, and gnd to pin... no red led, nothing. if I wire them up in a way that works.... well it is on... I can tell that much, but the attiny is not reading it as high or low.... i'm embarrassed to say i've been out done by a sensor.

I've used them before and I remember using one to either read high or low like a button....

so perhaps I've wired it wrong, perhaps I've used the wrong kind of code....

here is the code i'm using. i tried using these sensors to either read high or low, but perhaps they are more complicated than that?

does anyone have any resources or examples I could check out? i'm completely lost

int inputPin = 3;
int inputPin2 = 4;
int transPin = 2;

void setup() {
// put your setup code here, to run once:
pinMode(inputPin, INPUT);
pinMode(inputPin2, INPUT);
pinMode(transPin, OUTPUT);

void loop() {
if (digitalRead(inputPin) == HIGH && digitalRead(inputPin2) == HIGH)
digitalWrite(transPin, HIGH);
else {
digitalWrite(transPin, LOW);