Hi Antonio,
Please how can i change the voltage of a digital out to set up it at 1.3 and not at 3.3? Also can I set up An AnalogIn at 500mV when i ve on it 1.5V??
It sounds like you want a
Potential Divider. This is just a couple of resistors to provide an output voltage that is a fraction of the input voltage.
So, for example:
Vinput(0v, 3.3v) --+
|
+-+
| | R1
| |
+-+
|
+----> Voutput(0v, 1.3v)
|
+-+
| | R2
| |
+-+
|
GND ---+---
Then you need to calculate some values for R1 and R2, which is based on the ratio/fraction you need. The calculation is therefore:
Voutput = Vinput * R2 / (R1 + R2)
So something like R1 of 15k and R2 of 10k, would give you:
Voutput = 3.3 * 10 / (10 + 15) = 1.32v
For the AnalogIn case, the range is normalised between 0.0 (0v) and 1.0 (3.3v). Therefore, to scale it to another linear scale you would just multiply by the maximum value you wanted to see. So if you wanted your AnalogIn to range between 0.0-3.3 as the input voltage changed between 0v and 3.3v (i.e. represent the actual voltage), you'd simply do:
AnalogIn x(p19);
float voltage = x * 3.3;
If you wanted it to range between 0.0 and 0.3, you'd multiply by 0.3.
Hope that helps you get it working.
Simon
Hello every one
Please how can i change the voltage of a digital out to set up it at 1.3 and not at 3.3?
Also can I set up An AnalogIn at 500mV when i ve on it 1.5V??
Tk for the helping
Regards
Antonio