help me to create sketch

i would like to connect inductive proximity sensor and 2ch relay module with arduino uno.

but i am not expert in creating sketch , please help me to create it as per my functionality .

i know how to connect the hardware to each other.

things i have got

  1. arduino uno

  2. 2ch relay module

  3. inductive proximity sensor (pnp) 12v

functionality is, when sensor cover by object the ralay1 turn high

when sensor discover, relay1 turn low and another relay2 turn high but there must be time gap about 5 sec between relay activation.

again when sensor cover by object the relay2 turn low and another relay1 turn high but same time gap must be there between activation of relays

thankyou.

  1. inductive proximity sensor (pnp) 12v

You need hardware that is compatible, voltage-wise, with the Arduino. Smoke happens if you feed 12V into the Arduino.

Until you have useful hardware, the sketch is pointless.

Without knowing how you have connected the hardware, no one could write a sketch for you. That is not what we do here, anyway. What we do here is help you write a sketch. Reading from, and writing to, digital pins is extremely simple.

thank you very much for reply.

as per your question the inductive sensor is operate on 5v to 12v

so can be connected to arduino.

here i have attached the hardware image please have a look.

i thing by seeing this attachment you will better understand about my functionality.

index.jpg

index1.jpg

Power connected to the barrel jack must be between 7 and 12 volts, connect signal wire to a digital pin, pin 2 would work. Have you tried to write any kind of sketch? If so, please post it, we can go from there.

well i have not created any sketch about my desire functionality, as per your guided i will put signal wire to digital pin2

please create sketch for me .

functionality is, when sensor cover by object the ralay1 turn high

when sensor discover, relay1 turn low and another relay2 turn high but there must be time gap about 5 sec between relay activation.

again when sensor cover by object the relay2 turn low and another relay1 turn high but same time gap must be there between activation of relays

thank you.

Hi,

Can you tell us your electronics, programming, Arduino, hardware experience?

What is the application?

Thanks.. Tom... :slight_smile: