* D4 PD4/T0
* D5 PD5/OC0B/T1
* D6 PD6/OC0A/AIN0 LED
- * D7 PD7/AIN1
+ * D7 PD7/AIN1 Pointlaser
* D8 PB0/ICP1
* D9 PB1/OC1A
* D10 PB2/SS/OC1B
if (ins == DYNAMIXEL_WRITE && param_len == 3 && addr == 1) {
OCR0A = 255 - param[2];
return 1; // status reply, ERR = 0
- }
- if (ins == DYNAMIXEL_READ && addr == 2) {
+ } else if (ins == DYNAMIXEL_READ && addr == 2) {
uint16_t temp = mlx90614_read_temp_tenths();
if (temp == 0) {
*err = 0x04; // hardware error: sensor read failed
*reply_len = 2;
}
return 1;
+ } else if (ins == DYNAMIXEL_WRITE && param_len == 3 && addr == 3) {
+ if (param[2]) {
+ PORTD |= (1<<7);
+ } else {
+ PORTD &= ~(1<<7);
+ }
}
return 0; // stay silent
}
int main(void) {
- DDRD = (1<<6);
+ DDRD = (1<<6) | (1 << 7);
PORTD = (1<<6);
PORTC = (1<<4) | (1<<5); // I2C Pullups
setup_uart(9600);