File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 3535
3636
3737# Internal constants:
38- _MCP4725_DEFAULT_ADDRESS = const (0b01100000 )
38+ _MCP4725_DEFAULT_ADDRESS = const (0b01100010 )
3939_MCP4725_WRITE_FAST_MODE = const (0b00000000 )
4040
4141
@@ -92,7 +92,7 @@ def _read(self):
9292 dac_high = self ._BUFFER [1 ]
9393 dac_low = self ._BUFFER [2 ] >> 4
9494 # Reconstruct 12-bit value and return it.
95- return ((dac_high << 8 ) | dac_low ) & 0xFFF
95+ return ((dac_high << 4 ) | dac_low ) & 0xFFF
9696 finally :
9797 # Ensure bus is always unlocked.
9898 self ._i2c .unlock ()
Original file line number Diff line number Diff line change 3333# Main loop will go up and down through the range of DAC values forever.
3434while True :
3535 # Go up the 12-bit raw range.
36+ print ('Going up 0-3.3V...' )
3637 for i in range (4095 ):
3738 dac .raw_value = i
3839 # Go back down the 12-bit raw range.
40+ print ('Going down 3.3-0V...' )
3941 for i in range (4095 , - 1 , - 1 ):
4042 dac .raw_value = i
You can’t perform that action at this time.
0 commit comments