SLOA312 December 2021 DRV8412 , DRV8424 , DRV8426 , DRV8428 , DRV8434 , DRV8436 , DRV8803 , DRV8804 , DRV8805 , DRV8806 , DRV8844 , DRV8847 , DRV8932 , DRV8935 , DRV8955
PRODUCTION DATA
1. /// 0111 1011 1101 1110 // input format for full step one phase ON
2.
3. int in1 = 8;
4. int in2 = 9;
5. int in3 = 10;
6. int in4 = 11;
7.
8. int i = 0;
9. int freq = 200;
10. unsigned long t_half =0.5*(1000000/freq);
11.
12. void setup()
13. { pinMode(in1, OUTPUT);
14. pinMode(in2, OUTPUT);
15. pinMode(in3, OUTPUT);
16. pinMode(in4, OUTPUT);
17. }
18.
19. void loop() {
20. delayMicroseconds(t_half);
21. i=i+1;
22. if (i >=4) {i=0;}
23. switch(i)
24. {
25. case 0:
26. digitalWrite(in1,LOW);
27. digitalWrite(in3,HIGH);
28. digitalWrite(in2,HIGH);
29. digitalWrite(in4,HIGH);
30. break;
31. case 1:
32. digitalWrite(in1,HIGH);
33. digitalWrite(in3,LOW);
34. digitalWrite(in2,HIGH);
35. digitalWrite(in4,HIGH);
36. break;
37. case 2:
38. digitalWrite(in1,HIGH);
39. digitalWrite(in3,HIGH);
40. digitalWrite(in2,LOW);
41. digitalWrite(in4,HIGH);
42. break;
43. case 3:
44. digitalWrite(in1,HIGH);
45. digitalWrite(in3,HIGH);
46. digitalWrite(in2,HIGH);
47. digitalWrite(in4,LOW);
48. break;
49. }
50. }