Go Down

Topic: Arduino Mini 05 I2C (Read 924 times) previous topic - next topic

skateone

Nov 06, 2012, 10:47 am Last Edit: Nov 07, 2012, 08:55 am by Coding Badly Reason: 1
hi there guys. i have just started using the Arduino Mini 05 and am trying to find more information regarding the I2C interface.
From what i saw the Wire.h lib automatically handles the IO. but as far as my testing is going i am not able to get the I2C interface operational.

i am trying to interface to an MCP23016 16bit IIC bus expander.
has anyone managed to get this working and if you don't mind how?

Code: [Select]
#include <Wire.h>
const int LED = 13;

void setup() {
 
 pinMode(LED, OUTPUT);
 Wire.begin();
 Wire.beginTransmission(0x40);
 Wire.write(0x06);
 Wire.write(0x00);
 Wire.endTransmission();
 
 
}


void loop() {
   digitalWrite(LED, HIGH);
   delay(1000);
   digitalWrite(LED, LOW);
 

 delay(1000);
 
 Wire.beginTransmission(0x40);
 Wire.write(0x00);
 Wire.write(0xFF);
 Wire.endTransmission();
 
}



Moderator edit: [code] [/code] tags added.

pylon

Code: [Select]
  Wire.beginTransmission(0x40);


The 7-bit address of a standard MCP23016 (all address pins grounded) is 0x20 and not 0x40.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy