Input 6V, output close to 2.5V is the best
but now, it is 2V
need to recalculate the threshold
6*(10/(22+10)) = 1.875 ---------------- -- 3.3 (0.5681 of 3.3)
4.3*(10/(22+10))=1.34375 ------------------ 3.3 (0.407 of 3.3)
3.3 is 4095 Because the adc of stm32 is a 12-bit twelve-bit full scale is 0xfff---> 4096
0.47 is 1667
{4.3*(10/(22+10))}/3.3*4095
The circuit diagram is as follows