Good Evening,
I wrote a simple code which suppose to take the input from proximity sensors and analogWrite it on microcontroller pins. I'm trying to take the value from right sensor and write that value on pin 12. Then take the value from left sensor and write it on pin 13. I'm using map() function to scale it down (10 bit to 8 bit).
But it take the value from one sensor and write this on both 12 and 13. So if I move my hand in front of right sensor (or left sensor) value on both 12 and 13 changes at the same time. Right sensor only suppose to adjust ouput waveform on pin 12. Left sensor suppose to only adjust the waveform on pin 13.
I tried with motors first. Then I tested the signals on oscilloscope. I got exact same result.
I'm using Sharp IR proximity sensors (GP2Yxxxx). I tested the sensors using serial monitor and multimeter. They are working great.
Below is my code. Any help will be greatly appreciated.
