File tree 2 files changed +4
-2
lines changed
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 35
35
36
36
37
37
# Internal constants:
38
- _MCP4725_DEFAULT_ADDRESS = const (0b01100000 )
38
+ _MCP4725_DEFAULT_ADDRESS = const (0b01100010 )
39
39
_MCP4725_WRITE_FAST_MODE = const (0b00000000 )
40
40
41
41
@@ -92,7 +92,7 @@ def _read(self):
92
92
dac_high = self ._BUFFER [1 ]
93
93
dac_low = self ._BUFFER [2 ] >> 4
94
94
# Reconstruct 12-bit value and return it.
95
- return ((dac_high << 8 ) | dac_low ) & 0xFFF
95
+ return ((dac_high << 4 ) | dac_low ) & 0xFFF
96
96
finally :
97
97
# Ensure bus is always unlocked.
98
98
self ._i2c .unlock ()
Original file line number Diff line number Diff line change 33
33
# Main loop will go up and down through the range of DAC values forever.
34
34
while True :
35
35
# Go up the 12-bit raw range.
36
+ print ('Going up 0-3.3V...' )
36
37
for i in range (4095 ):
37
38
dac .raw_value = i
38
39
# Go back down the 12-bit raw range.
40
+ print ('Going down 3.3-0V...' )
39
41
for i in range (4095 , - 1 , - 1 ):
40
42
dac .raw_value = i
You can’t perform that action at this time.
0 commit comments