arduino_and_i2c

An Arduino board driving the I2C peripheral that had been connected to a LEGO Mindstorms NXT before - www.flickr.com/photos/56083335@N00/3621104957/ .

 

We could also use LEGO NXT sensors / actors with the Arduino.

 

 

/*

Test program for PCF8574 I2C I/O expander

*/

 

#include <Wire.h>

 

#define expander B0100000

 

void setup() {

Wire.begin();

}

 

void loop() {

int i;

for (i=0; i <= 9; i++)

{

expanderWrite(i);

delay(1000);

}

}

 

void expanderWrite(byte _data ) {

Wire.beginTransmission(expander);

Wire.send(_data);

Wire.endTransmission();

}

 

992 views
1 fave
0 comments
Uploaded on June 13, 2009