Skip to content

Commit 144e1d7

Browse files
committed
+ extended example
+ set I2C -> 100KHz
1 parent 4126dfc commit 144e1d7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

libraries/MCP4725/MCP4725.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ MCP4725::MCP4725(uint8_t device)
2323
void MCP4725::begin()
2424
{
2525
Wire.begin();
26-
2726
TWBR = 72;
27+
2828
// 0=1000 1=888 2=800 8=500
2929
// 12=400KHz 24=250 32=200 72=100 152=50
3030
// F_CPU/16+(2*TWBR) // TWBR is a uint8_t

libraries/MCP4725/examples/mcp4725_test/mcp4725_test.ino

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ void setup()
8181

8282
void loop()
8383
{
84+
for (int i=0; i< 4096; i++)
85+
{
86+
DAC.setValue(i);
87+
delay(10);
88+
}
89+
for (int i=0; i< 4096; i++)
90+
{
91+
DAC.setValue(4096 - i);
92+
delay(10);
93+
}
8494
}
8595

8696

97+

0 commit comments

Comments
 (0)