Advertisement
Guest User

Silniki krokowe

a guest
Mar 26th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <AccelStepper.h>
  3. #define HALFSTEP 8
  4.  
  5. // Definicje pinów silnika// Definicje pinów silnika
  6. #define motorPin1 8 // IN1 na sterowniku ULN2003 1  
  7. #define motorPin2 9 // IN2 na sterowniku ULN2003 1
  8. #define motorPin3 10 // IN3 na sterowniku ULN2003 1
  9. #define motorPin4 11 // IN4 na sterowniku ULN2003 1
  10.  
  11. // Inicjalizuj z sekwencją pinów IN1-IN3-IN2-IN4, aby używać AccelStepper z 28BYJ-48
  12. AccelStepper motor (HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
  13.  
  14. void setup () {void setup () {
  15.   motor.setMaxSpeed ​​(1000.0);
  16.   motor.setAcceleration (100.0);
  17.   motor.setSpeed ​​(20);
  18.   motor.moveTo (20000);
  19.  
  20. } // - (konfiguracja końcowa) ---} // - (konfiguracja końcowa) ---
  21.  
  22. void loop () {void loop () {
  23.  
  24.   // Zmień kierunek, gdy stepper osiągnie pozycję docelową// Zmień kierunek, gdy stepper osiągnie pozycję docelową
  25.   if (stepper1.distanceToGo () == 0) {if ( stepper1 . distanceToGo () == 0 ) {    
  26.     stepper1.moveTo (-stepper1.currentPosition ());. moveTo (- stepper1 . currentPosition ());
  27.   }}
  28.   stepper1.run ();. run ();
  29. }}
  30.  
  31.  
  32. Arduino:1.8.9 (Windows 7), Płytka:"Arduino/Genuino Uno"
  33.  
  34. Silnik_krokowy:15:3: error: stray '\342' in program
  35.  
  36. Silnik_krokowy:15:3: error: stray '\200' in program
  37.  
  38. Silnik_krokowy:15:3: error: stray '\213' in program
  39.  
  40. Silnik_krokowy:15:3: error: stray '\342' in program
  41.  
  42. Silnik_krokowy:15:3: error: stray '\200' in program
  43.  
  44. Silnik_krokowy:15:3: error: stray '\213' in program
  45.  
  46. Silnik_krokowy:17:3: error: stray '\342' in program
  47.  
  48. Silnik_krokowy:17:3: error: stray '\200' in program
  49.  
  50. Silnik_krokowy:17:3: error: stray '\213' in program
  51.  
  52. Silnik_krokowy:17:3: error: stray '\342' in program
  53.  
  54. Silnik_krokowy:17:3: error: stray '\200' in program
  55.  
  56. Silnik_krokowy:17:3: error: stray '\213' in program
  57.  
  58. C:\Users\Michał\Desktop\Projekty\Nauka\Lekcja 1\Silnik_krokowy\Silnik_krokowy.ino: In function 'void setup()':
  59.  
  60. Silnik_krokowy:14:30: error: a function-definition is not allowed here before '{' token
  61.  
  62. Silnik_krokowy:22:14: error: a function-definition is not allowed here before '{' token
  63.  
  64. Silnik_krokowy:29:2: error: expected '}' at end of input
  65.  
  66. exit status 1
  67. stray '\342' in program
  68.  
  69. Ten raport powinien zawierać więcej informacji jeśli w
  70. File -> Preferencje zostanie włączona opcja "Pokaż
  71. szczegółowe informacje podczas kompilacji"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement