slipstick:
Within 40cm of all of the sensors or of any one or some combination? How do you plan on making a tone? Some sort of buzzer/speaker? What sort and where is it connected?If you had posted what you have tried I might have been able to guess some answers.
Steve
It would be 40cm on all sensors, for tone I would just use tone(2,1000,100); as I have a piezo speaker on pin 2.
I have the sensors arranged so they create a wider field of view, maybe 130 degrees
Im wanting it so that if anything comes within 40cm on the sensor, the leds will turn on and tone will activate
Kinda like
if (distance# < 40 && distance# > 0){ //# is the distance for each sensor, ex distance is for sensor1
digitalWrite(led1, HIGH); // and distance1 is for sensor 2.
tone(2,1000,100);
delay(50);
tone(2,1000,100);
delay(20);
I just don't know where the distance is stored in the code that will work with something like that.
The distance of each sensor is stored in an array and im just so confused with this
I would like to have this working by tomorrow