Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Arduino Uno, I2C cannot communicate with digitalpotentiometer~~!!!

$
0
0

I'm using AD5258 digitalpot, but my arduino cannot control it, and my program always freeze at Wire.endTransmission(); My code is quite simple, I just want to use arduino to control digitalpot so as to supply a specific voltage. I need ur help~~  Thx a lot~ :blink: 

#include <Wire.h>

int dt = 500;
byte rval = 0;
int led =13;
//boolean ledOn=LOW;


void setup()
{
  Wire.begin();
  Serial.begin(9600);
  pinMode(led,OUTPUT);
}

void loop()
{

    Wire.beginTransmission(0x18);
    Wire.write(byte(0x00));            
    Wire.write(rval);
    Wire.endTransmission();
    //ledOn=!ledOn;
    //digitalWrite(led,ledOn);
    Serial.print(" sent - ");
    Serial.println(rval,HEX);

    rval++;        // increment value
    if(rval == 64) // if reached 64th position (max)
    {
      rval = 0;    // start over from lowest value
    }
    delay(dt);
   
}

Viewing all articles
Browse latest Browse all 2077

Trending Articles