Hey guys this is an addition to the previous post about a week ago but I am struggling to find a way to have multiple proximity sensors activating multiple relays at different distances please read below. I have tried to have 2 sensors activating the same relays at different distances but I cant really find a way to as the relays are depending on the "cm" value which is being read from the all the sensors not individual ones. So if I do try and set the relays off at different distances they go off and on no matter which sensor. So what I am trying to do is: Sensor 1: Sensor 2: At 100cm>0cm activate relay1 At 150cm>0cm activate relay1 and 50cm>0cm activate relay2 and 75cm>0cm activate relay2
and then this will be expanded up to 4-5 sensors and 3-4 relays. So right not I want to get the basics working with the minimum to test which will then allow me to expand onto multiple sensors and relays.
This is the code my friend wrote: http://pastebay.com/146241 and this is the code I wrote: http://pastebay.com/146242 I would prefer to use my friends code as it works slightly different to mine and mine uses the millis function which does count the time which overlaps.
Thanks to anyone who can find a way to get this to work.