Skip to content

Instantly share code, notes, and snippets.

@lithium
Created April 12, 2018 13:57
Show Gist options
  • Select an option

  • Save lithium/b67d50e1ff22a7e8638aad9f92eb245c to your computer and use it in GitHub Desktop.

Select an option

Save lithium/b67d50e1ff22a7e8638aad9f92eb245c to your computer and use it in GitHub Desktop.
#include <Wire.h>
#include <Adafruit_MCP4725.h>
Adafruit_MCP4725 dac;
#define GATE_PIN 12
void setup() {
dac.begin(0x62);
dac.setVoltage(0, 0);
}
void loop() {
uint16_t v = random(0, 65535);
dac.setVoltage(v, 0);
digitalWrite(GATE_PIN, 1);
delay(500+random(0,500));
digitalWrite(GATE_PIN, 0);
delay(500+random(0,500));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment