We are trying to learn how to connect non-FT components; sensors, servos, etc to the TX-Controller, now that the I2C connection has finally arrived.
Our background in electronics is not very good but we know a bit of basic programming from dealing with HTML & PHP.
We have assembled the various pieces so far but would appreciate some guidance in making the correct connections from an Arduino-compatible controller to the TX-C.
Based on Rei Vilo's fantastic website here;
http://reivilofischertechnik.weebly.com ... rface.html
we get that from the TX-C we have this;

and from the Arduino forum;
http://www.arduino.cc/cgi-bin/yabb2/YaB ... 1208761098
on the slave side, ie. the Arduino; we have this;
Code: Alles auswählen
#include <Wire.h>
void setup()
{
Wire.begin(2); // join i2c bus with address #2
Wire.onRequest(requestEvent); // register event
Serial.begin(9600); // start serial for output
}
void loop()
{
delay(100);
}
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void requestEvent()
{
static char c = '0';
Wire.send(c++);
if (c > 'z')
c = '0';
}
1) on the ROBO Pro side, is "0x14" the address of the Arduino with respect to the TX-C ?
2) in the slave code,
Wire.begin(2); // join i2c bus with address #2
Wire.onRequest(requestEvent); // register event
would the code in "void requestEvent()" be activated by sending/writing "0x02" from ROBO Pro ?
3) can one register more than one 'event', and how would they be called in a switch...case loop ?
would it be something like this ?
Code: Alles auswählen
switch (command) {
case 0x52: // reset
mySensor.reset();
Serial.print("< reset");
Serial.println();
break;
case 0x02: //
// do something else
break;
case 0x03: //
// do something else again
break;
}
Cheers.
G-COM