+ extended example

+ set I2C -> 100KHz
This commit is contained in:
Rob Tillaart 2013-11-30 22:21:07 +01:00
parent 4126dfc63a
commit 144e1d7e02
2 changed files with 12 additions and 1 deletions

View File

@ -23,8 +23,8 @@ MCP4725::MCP4725(uint8_t device)
void MCP4725::begin()
{
Wire.begin();
TWBR = 72;
// 0=1000 1=888 2=800 8=500
// 12=400KHz 24=250 32=200 72=100 152=50
// F_CPU/16+(2*TWBR) // TWBR is a uint8_t

View File

@ -81,6 +81,17 @@ void setup()
void loop()
{
for (int i=0; i< 4096; i++)
{
DAC.setValue(i);
delay(10);
}
for (int i=0; i< 4096; i++)
{
DAC.setValue(4096 - i);
delay(10);
}
}