Teensy3.0 interface with ADC Code problem

Status
Not open for further replies.

twiny67

New member
I want to interface I2C ADC device with Teensy 3.6 I have Code for arduino nano will this code work for Teensy also or not ? should have to write in C language to make it interface ?
 
Most of Arduino Nano code, if correctly written, will run on the Teensy. The Teensy core library makes basically a huge effort to maintain backwards compatibility with old and weak-chested Arduino stuff. But if the developer of your specific code did it in a bad way, using proprietary AVR register definitions for example, you will have to rewrite these.

A first look onto the GitHub code you linked to gave me the impression that it should just work. You'll have probably to add the line #include <Wire.h> before setup().

But why do you ask? Just try it out and report your experience back. :)
 
There are several problems with the device and code combination you linked in post #1.

First, the device link is for a 5v 16bit DAC, not an ADC as you say you want to interface. Moreover since the DAC is a 5v device, I doubt that it will be compatible with the 3.3v Teensy 3.6 which is not 5v tolerant.

Second, the code you linked is for a 12bit ADC whoes I2C address is hardcoded as 0x29 (the I2C address for the linked DAC is 0xC). In addition, the code is written for the Particle development environment and makes function calls that, to my knowledge, are not supported in the Arduino environment which is what Teensy code development is based on.

I think you should do a bit more research and carefully read the product literature before spending $80 for a 4 channel DAC if what you really want is an I2C ADC module. Also if you are not comfortable writing the interface code yourself, you should look for one that is supported by code written for the Arduino environment.
 
Status
Not open for further replies.
Back
Top