Python Examples
Example 1 - Basic
The first example writes the DAC with three different voltages: 0V, 1.65V, and 3.3V using the write_dac() function. The example steps through each voltage every two seconds and prints each voltage write.
Example 2 - Waveform
Example 2 uses data from a lookup table to generate waveforms with the MCP4275.
Example 3 - Write EEPROM
The third example writes the DAC and EEPROM with a single command using the write_dac_eeprom() function. The MCP4725 has an EEROM that can store a single 12-bit DAC value as well as two configuration bits for the power down mode. The DAC will output this value on reset or power-cycle. The example sets the value to 2048 (~1.65V with VDD @3.3V).
Example 4 - Read
This example writes the DAC and then reads the DAC value back from the device using the read_dac_eeprom() function.
Example 5 - Power Down
Example 5 demonstrates how to enter and leave power-down mode on the MCP4725. Power-down mode reduces the current consumption of the DAC to ~60nA (typical). The example cycles the MCP4725 into power down mode for a few seconds and then wakes it by issuing the normal write_dac() function.
Example 6 - Fast Write
This example uses fast mode to write the DAC with three example voltages: 0V, 1.65V, and 3.3V using the write_fast_mode() function. It steps through each voltage every two seconds and prints out each voltage write.