// Wire Master Writer // by Nicholas Zambetti // Demonstrates use of the Wire library // Writes data to an I2C/TWI slave device // Refer to the "Wire Slave Receiver" example for use with this // Created 29 March 2006 // This example code is in the public domain. #include #define X_Axis_Register_DATAX0 0x32 // Hexadecima address for the DATAX0 internal register. #define X_Axis_Register_DATAX1 0x33 // Hexadecima address for the DATAX1 internal register. #define attiny_adress void setup() { Wire.begin(0x3A); // join i2c bus (address optional for master) } byte x = 0; void loop() { Wire.beginTransmission(attiny_adress); // transmit to motor attiny Wire.write(X_Axis_Register_DATAX0); Wire.write(X_Axis_Register_DATAX1); Wire.endTransmission(); // stop transmitting x++; delay(500); }