fork(1) 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. void moveservo();
  8.  
  9. int i;
  10.  
  11. int main(void)
  12. {
  13. DDRC = 0xFF; //Set all PORT C as output
  14. PORTC = 0xFE; //Turn on D1 LED
  15. cli(); //Disable global interrupts
  16. TCCR1A = 0; //set entire TCCR1A to 0
  17. TCCR1B = 0; //set entire TCCR1B to 0
  18. OCR1A = 15624; // set compare match register to desired timer count
  19. TCCR1B |= (1 << WGM12); // turn on CTC mode:
  20. TCCR1B |= (1 << CS10); // Set CS10 and CS12 bits for 1024 prescaler:
  21. TCCR1B |= (1 << CS12);
  22. TIMSK1 |= (1 << OCIE1A);// enable timer compare interrupt:
  23.  
  24.  
  25.  
  26. sei(); // enable global interrupts
  27.  
  28. dxl_initialize(0,1); //0= number connected com devices, 1= Baud rate
  29. serial_initialize(57600);
  30.  
  31.  
  32. while(1)
  33. {
  34. int x = 2;
  35. if (x > 3)
  36. printf("test");
  37.  
  38. }
  39. return 1;
  40. }
  41.  
  42.  
  43. ISR(TIMER1_COMPA_vect)
  44. {
  45. static int j=0, i=0;
  46. j++;
  47. if (j>=64) {
  48. j=0;
  49. //PORTC = ~(1<<i);
  50. i++;
  51. if (i > 4) i=0;
  52. int goal_pos = 160*i;
  53. int mot_num = 18;
  54. int address = 30;
  55. //int pos = dxl_read_word(18,36);
  56. dxl_write_word(254,address,goal_pos);
  57. }
  58. }
  59.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty