I have a distance sensor connected to an Arduino DUE and I want to wire its output to an Arduino UNO.
In Arduino DUE, after calculating the distance, I convert a range of distances (0-10cm) to Volts (0-5V), then I map these to 0-255 values and I do AnalogWrite at the DAC pin.
In Arduino UNO, I AnalogRead from an analog pin (A0) which is connected with a jumpwire to the DAC pin of Arduino DUE. I was expecting to get values between 0 (when the distance is 0 cm) and 1023 (when the distance is 10 cm). But instead I get a weird and unstable range between 100 and 548.
The two Arduinos are connected with a jumpwire between grounds and a jumpwire between DAC and A0.
What am I doing wrong? I thought I had understood how to do this, but apparently not :)
Thank you for your help and time in advance!