- Try to complete the “Sprinkler Challenge” with the standard Servo by changing the code so that your standard Servo behaves like a water sprinkler. Starting at 0, the servo should move to a range of angles between 0 and 180 degrees before rapidly returning back to 0 degrees and then cycling through the range of angles again.
- Try changing your code so that the continuous sServo begins at a stop, then begins slowly rotating, then slowly speeds up until it is at maximum speed in that direction (0 or 180), then comes to an abrupt stop before repeating.
- The program was uploading before, but not anymore / “problem uploading to board” 1. Windows, open the Arduino software, paste your code, uploadCheck the most obvious first, that the Arduino board is connected to the computer with the USB cable.
- Check that the Arduino is connected to the right COM port, then upload again.
• To check, go to Tools > Port and see if “COM# (Arduino/Genuino Uno)” is next to the word “Port”.
• If not, select the option mentioned above.
• If no COM# shows “(Arduino/Genuino Uno)” next to it, make sure that your USB cable is connected to both the Arduino board and the USB port of the computer.
- Try unplugging and re-plugging the USB cable and uploading again
- Try disconnecting all wires from the Arduino board and uploading again
1. Another way to explain how to choose the correct Servo and write the program for that Servoout code is to write it out as if you’re explaining what you want the Sservo to do. Write it out in the way of a list:
- I want my flower to spin to the right for 1 second
- I want my flower to stop spinning 3 seconds
2. The fact that I want my Servo to “spin” tells me I should use the continuous Servo.
3. Next, break up that list into Servo actions and Arduino pauses (remember Simon says!)
- Spin to the right
- Pause for 1 second
- Stop spinning
- Pause for 1 second
4. Then associate that list with lines of code that will accomplish that.
Line 1: Spin to the right
• Values greater than 90 will make the continuous Servo spin to the right
• Let’s choose 150, giving us: “myservo.write(150);”
Line 2: Pause I don’t want to change actions for 1 second
• A delay will pause the Arduino before reading another line of code, meanwhile all previous actions will continue to run meaning that the Servo will spin to the right for this 1 second pause.
•“delay(1000);”
Line 3: Stop spinning
•A value around 90 should get the continuous Servo to stop. Try different values close to 90 until it does stop.
•“myservo.write(-90 );” (or the value close to 90 you found to be “stop”)
Line 4: Pause for 3 seconds
• A delay will pause the Arduino before reading another line of code, meanwhile all previous actions will continue to run, meaning that the Servo will stay stopped for this 3 second pause
• “delay(3000);”