Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #define MotorSpeed 7
  2. #define MotorDirection 6
  3. #define MotorSpeed2 5
  4. #define MotorDirection2 4
  5.  
  6. void setup(){
  7.  
  8. pinMode(MotorSpeed, OUTPUT);
  9. pinMode(MotorDirection, OUTPUT);
  10. pinMode(MotorSpeed2, OUTPUT);
  11. pinMode(MotorDirection2, OUTPUT);
  12.  
  13. Serial.begin(9600);
  14. }
  15.  
  16.  
  17. void loop() {
  18.  
  19. for(int motorValue = 0 ; motorValue <= 255; motorValue +=10){
  20. analogWrite(MotorSpeed, motorValue);
  21. delay(100);
  22. }
  23.  
  24. {
  25. analogWrite(MotorSpeed, 255);
  26. delay(1000);
  27. }
  28.  
  29. {
  30. for(int motorValue = 255 ; motorValue >= 0; motorValue -=10){
  31. analogWrite(MotorSpeed, motorValue);
  32. delay(100);
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement