Jump to content
Sign in to follow this  
GYB

Arduino Uno, Wire.endTransmission(); freeze

Recommended Posts

I'm using AD5258 digitalpot, but my arduino cannot control it, and my program always freeze at Wire.endTransmission();[Which means the program stuck there

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);
   
} 

] 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~

Share this post


Link to post
Share on other sites

Hey GYB,

 

I've not used the arduino wire libary before. But from limited google searches I can give you some insight.

 

The wire.endtransmission(); command sends a stop command to the sensor and waits for an acknologement before returning.

So most likely the sensor is not connected properly to your arduino. Can you provide a schematic of how the sensor is connected in your system?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...