Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <main.h>
- #define bob1l pin_a0
- #define bob1r pin_a1
- #define bob2l pin_a6
- #define bob2r pin_a7
- void main()
- {
- while(TRUE)
- {
- output_low(bob1l);
- pwm_set_duty_percent(1000);
- delay_ms(100);
- pwm_set_duty_percent(500);
- delay_ms(400);
- output_high(bob1r);
- pwm_set_duty_percent(1000);
- delay_ms(100);
- pwm_set_duty_percent(500);
- delay_ms(400);
- output_low(bob2l);
- pwm_set_duty_percent(1000);
- delay_ms(100);
- pwm_set_duty_percent(500);
- delay_ms(400);
- output_high(bob2r);
- pwm_set_duty_percent(1000);
- delay_ms(100);
- pwm_set_duty_percent(500);
- delay_ms(400);
- output_low(bob1r);
- pwm_set_duty_percent(1000);
- delay_ms(100);
- pwm_set_duty_percent(500);
- delay_ms(400);
- output_high(bob1l);
- pwm_set_duty_percent(1000);
- delay_ms(100);
- pwm_set_duty_percent(500);
- delay_ms(400);
- output_low(bob2r);
- pwm_set_duty_percent(1000);
- delay_ms(100);
- pwm_set_duty_percent(500);
- delay_ms(400);
- output_high(bob2l);
- pwm_set_duty_percent(1000);
- delay_ms(100);
- pwm_set_duty_percent(500);
- delay_ms(400);
- }
- }
- ---------------------------------------------------------------------------
- #include <main.h>
- #define bob1l pin_a0
- #define bob1r pin_a1
- #define bob2l pin_a6
- #define bob2r pin_a7
- void main()
- {
- const int halfstep[] = { 0x01, 0x03, 0x02, 0x06, 0x04, 0x0B, 0x08, 0x09 };
- while(TRUE)
- {
- for(int i=0; i<7; i++)
- {
- output_bit(bob1l,bit_test(halfstep[i],0));
- output_bit(bob1r,bit_test(halfstep[i],1));
- output_bit(bob2l,bit_test(halfstep[i],2));
- output_bit(bob2r,bit_test(halfstep[i],3));
- pwm_set_duty_percent(1000);
- delay_ms(100);
- pwm_set_duty_percent(500);
- delay_ms(400);
- }
- }
- }
- ---------------------------------------------------------------------------
- #include <main.h>
- #define bob1l pin_a0
- #define bob1r pin_a1
- #define bob2l pin_a6
- #define bob2r pin_a7
- void main()
- {
- const int halfstep[] = { 0x01, 0x03, 0x02, 0x06, 0x04, 0x0B, 0x08, 0x09 };
- setup_timer_2(t2_div_by_4,250,16);
- setup_ccp1(ccp_pwm);
- while(TRUE)
- {
- for(int i=0; i<7; i++)
- {
- output_bit(bob1l,bit_test(halfstep[i],0));
- output_bit(bob1r,bit_test(halfstep[i],1));
- output_bit(bob2l,bit_test(halfstep[i],2));
- output_bit(bob2r,bit_test(halfstep[i],3));
- set_pwm1_duty(1000);
- delay_ms(100);
- set_pwm1_duty(500);
- delay_ms(400);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement