fork download
  1. #define F_CPU 16000000UL //Set processor speed 16 Mhz
  2. #include <avr/io.h>
  3. #include <avr/interrupt.h>
  4. #include <util/delay.h>
  5. #include <dynamixel.h>
  6.  
  7. int i;
  8.  
  9. int main(void)
  10. {
  11. DDRC = 0xFF; //Set all PORT C as output
  12. PORTC = 0xFE; //Turn on D1 LED
  13.  
  14. TCCR1B |= (1<<CS10);
  15. TCCR1B |= (1<<CS12);
  16. TIMSK1 |= (1<<TOIE1);
  17.  
  18. TCNT1 = 0;
  19. sei(); // enable global interrupts
  20.  
  21. dxl_initialize(0,1); //0= number connected com devices, 1= Baud rate
  22. serial_initialize(57600);
  23.  
  24.  
  25. while(1);
  26. }
  27.  
  28.  
  29.  
  30.  
  31. ISR(TIMER1_OVF_vect)
  32. {
  33. static int j=0, i=0;
  34. j++;
  35. if (j>=64) {
  36. j=0;
  37. //PORTC = ~(1<<i);
  38. i++;
  39. if (i > 4) i=0;
  40. int goal_pos = 160*i;
  41. int mot_num = 18;
  42. int address = 30;
  43. //int pos = dxl_read_word(18,36);
  44. dxl_write_word(254,address,goal_pos);
  45. }
  46. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty