Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
but when you start up the TWI system don't you have to declare the ATmega8 to be a slave? then the master takes over from there. another question. lets say I have I IR rangefinder mod. I am a TWI master. How would I get that info?
Also according to the specifications the actual commands need to be ASCII code that is human readable. So 0x53 (hex number) is not a valid message but something like IR1 or Read IR or even Distance Sensor 1This makes debugging a lot easier and with a good library its as easy as a printf statement to do (hint hint Webbot )
void motor_controller_set_speed(LEFT_MOTOR, 100);void motor_controller_brake();
#define LEFT_SPEED_REG 0x01uint_8 register = i2c_read_byte();switch(register) { case LEFT_SPEED_REG: { uint_8 value = i2c_read_byte(); set_pwm1(value); }; break;}