Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Code Example - Arduino Nano Wiring
- // SDA → A4 SCL → A5
- // VCC → 5V GND → GND
- // This toggles the DAC output between 0V and ~2.5V every second. The value 2048 is half
- // of the 12-bit max (4095), giving half the supply voltage.
- #include <Wire.h>
- #include <Adafruit_MCP4725.h>
- Adafruit_MCP4725 dac;
- void setup() {
- dac.begin(0x62);
- }
- void loop() {
- dac.setVoltage(2048, false);
- delay(1000);
- dac.setVoltage(0, false);
- delay(1000);
- }
Advertisement