Can't upload DAC Example Sketch

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
holdy97
 
Posts: 19
Joined: Wed Sep 28, 2022 5:45 pm

Can't upload DAC Example Sketch

Post by holdy97 »

Hello All,

I just got the Adafruit MCP4725. I downloaded the library, renamed it as they said, and then added it to Documents->Arduino->libaries

When I try to upload their example sketch "triangleWave", I get the following error

fatal error: Adafruit_BusIO_Register.h: No such file or directory
#include <Adafruit_BusIO_register.h>

I do not actually see this #include in the code, so I am not sure what to do. Any help would be great. Thanks

User avatar
holdy97
 
Posts: 19
Joined: Wed Sep 28, 2022 5:45 pm

Re: Can't upload DAC Example Sketch

Post by holdy97 »

Hi All,

Easy fix - just download and add BusIO library. It would be good if Adafruit added this as a required library on the DAC tutorial so others will know

User avatar
Franklin97355
 
Posts: 23939
Joined: Mon Apr 21, 2008 2:33 pm

Re: Can't upload DAC Example Sketch

Post by Franklin97355 »

I'll let them know.

User avatar
adafruit_support_carter
 
Posts: 29472
Joined: Tue Nov 29, 2016 2:45 pm

Re: Can't upload DAC Example Sketch

Post by adafruit_support_carter »

Thanks for pointing this out. That Learn page had (very) old instructions for installing the library. Page has been updated to show installing the library using Library Manager:
https://learn.adafruit.com/mcp4725-12-b ... th-arduino

Library Manager installs dependencies at the same time, so should take care of also bringing in Adafruit BusIO:
https://github.com/adafruit/Adafruit_MC ... erties#L10

User avatar
holdy97
 
Posts: 19
Joined: Wed Sep 28, 2022 5:45 pm

Re: Can't upload DAC Example Sketch

Post by holdy97 »

No problem. There is one more thing I'll bring up here.
I am using the DAC for a feedback controller I am working on. The arduino calculates the control input, and the DAC then gives the appropriate analog signal.

The controller is working well (the output tracks the reference), but if you look at the upper right figure, the analog signal from the DAC seems to not perfectly match the calculated input that the arduino is telling it to give.

I am using analogin on the arduino to read the DAC output. Would it be the analogread that is in error?
Attachments
fig.png
fig.png (67.5 KiB) Viewed 98 times

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”