Coder Social home page Coder Social logo

adafruit_mcp4725's Introduction

Adafruit_MCP4725 Build Status

This is the Adafruit MCP4725 12-bit I2C DAC Driver library

Tested and works great with the Adafruit MCP4725 Breakout Board ------> http://www.adafruit.com/products/935

This chip uses I2C to communicate, 2 pins are required to
interface

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Kevin Townsend/Limor Fried for Adafruit Industries.
BSD license, check license.txt for more information All text above must be included in any redistribution

To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_MCP4725. Check that the Adafruit_MCP4725 folder contains Adafruit_MCP4725.cpp and Adafruit_MCP4725.h

Place the Adafruit_MCP4725 library folder your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.

adafruit_mcp4725's People

Contributors

evaherrada avatar ladyada avatar lauszus avatar tdicola avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_mcp4725's Issues

Synchronous messages with two boards

I've got two MCP4725 for driving the x and y axes of a laser galvo. During the resulting motion one axis is drifting.
The result looks like this:
galvo_02
(It seems that first the x axis is moved and after that the y axis)

I am initializing the two boards this way:

Adafruit_MCP4725 dac0;
Adafruit_MCP4725 dac1;

#define DAC_RESOLUTION    (8)
#define TWI_FREQ 400000L

dac0.begin(0x62);
dac1.begin(0x63);
TWBR = 12; // 400 khz

And i am setting the values in loop()

dac1.setVoltage(yyy, false);
dac0.setVoltage(xxx, false);

Dependency BusIO missing

  • Arduino board: Arduino UNO (doesn't matter)

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.13 (doesn't matter)

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

  1. install this library
  2. create a minimal arduino code as below
#include <Adafruit_MCP4725.h>
void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

You will get

fatal error: Adafruit_BusIO_Register.h: No such file or directory

  • Proposed fix: Add BusIO to the list of dependencies of this library.

Generate 2.55 Volt DC (stable)

Hello,
I like to generate a stable output of 2.55Volt DC.
Maybe someone can help me to find a solution.
Thank you in advance, Urs

Compiler Errors when Using Arduino Due (Uno works ok)

With Arduino Due selected in IDE 1.6.5, when I try to compile the examples, or even an empty file with only Wire.h and this library included, I receive the following errors:
C:\Users\Brian\Documents\Arduino\libraries\Adafruit_MCP4725\Adafruit_MCP4725.cpp: In member function 'void Adafruit_MCP4725::setVoltage(uint16_t, bool)':
C:\Users\Brian\Documents\Arduino\libraries\Adafruit_MCP4725\Adafruit_MCP4725.cpp:67:22: error: 'TWBR' was not declared in this scope
uint8_t twbrback = TWBR;
^
Error compiling.

If I switch over to Arduino Uno, I receive no errors and my program runs.
Is there a different MCP4725 library for Due? How do I fix this? I downloaded the library on 10/30/2015 and am using IDE 1.6.5

TWBR Not Declared

When I try to compile the examples, I receive the following errors:
C:\Users\Brian\Documents\Arduino\libraries\Adafruit_MCP4725\Adafruit_MCP4725.cpp: In member function 'void Adafruit_MCP4725::setVoltage(uint16_t, bool)':
C:\Users\Brian\Documents\Arduino\libraries\Adafruit_MCP4725\Adafruit_MCP4725.cpp:67:22: error: 'TWBR' was not declared in this scope
uint8_t twbrback = TWBR;
^
Error compiling.

How do I fix this? I downloaded the library on 10/30/2015 and am using IDE 1.6.5

Locking up after 714 cycles

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: Nano

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.13

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

locks up after 714 cycles

#include <Wire.h>
#include <Adafruit_MCP4725.h>

Adafruit_MCP4725 dac;

long count;

void setup(void) {
Serial.begin(115200);
Serial.println("Hello!");
randomSeed(analogRead(0));
count =0;
}

void loop(void) {
uint16_t i;

i=1000;
Serial.println(count);
dac.begin(0x60);
dac.setVoltage(i,false);
delay(30);
dac.begin(0x61);
dac.setVoltage(i,false);
delay(30);
count++;

}

Compile error 'setSpeed'

  • Arduino board: Arduino Mega 2560

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.12

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

  1. Install MCP4725 library from the Arduino IDE (Libraries -> Install -> 'mcp4725')
  2. Open example 'sinewave' or 'trianglewave'
  3. Click 'Upload'

Compiler output:
C:\Users\Documents\Arduino\libraries\Adafruit_MCP4725\Adafruit_MCP4725.cpp: In member function 'bool Adafruit_MCP4725::setVoltage(uint16_t, bool, uint32_t)':

C:\Users\Documents\Arduino\libraries\Adafruit_MCP4725\Adafruit_MCP4725.cpp:71:12: error: 'class Adafruit_I2CDevice' has no member named 'setSpeed'; did you mean 'detected'?

i2c_dev->setSpeed(i2c_frequency); // Set I2C frequency to desired speed

        ^~~~~~~~

        detected

C:\Users\Documents\Arduino\libraries\Adafruit_MCP4725\Adafruit_MCP4725.cpp:87:12: error: 'class Adafruit_I2CDevice' has no member named 'setSpeed'; did you mean 'detected'?

i2c_dev->setSpeed(100000); // reset to arduino default

        ^~~~~~~~

        detected

exit status 1
Error compiling for board Arduino Mega or Mega 2560.

Two MCP4725

For my project I have t use two ADC's.
The MCP4725 has a pin A0 whichs allows to use two ADC's,

The problem is that the I2C-address has been fixed programmed wqithin the libray, so I can not use two examples.

How can that been solved?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.