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. TCCR0B |= (1<<CS02)|(1<<CS00);
  15. TIMSK0 |= (1<<TOIE0);
  16.  
  17. TCNT0 = 0;
  18. sei(); // enable global interrupts
  19.  
  20. dxl_initialize(0,1); //0= number connected com devices, 1= Baud rate
  21. serial_initialize(57600);
  22.  
  23.  
  24. while(1);
  25. }
  26.  
  27.  
  28.  
  29.  
  30. ISR(TIMER0_OVF_vect)
  31. {
  32. static int j=0, i=0;
  33. j++;
  34. if (j>=64) {
  35. j=0;
  36. //PORTC = ~(1<<i);
  37. i++;
  38. if (i > 4) i=0;
  39. int goal_pos = 160*i;
  40. int mot_num = 18;
  41. int address = 30;
  42. //int pos = dxl_read_word(18,36);
  43. dxl_write_word(254,address,goal_pos);
  44. }
  45. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty