Servos with circuit playground

Hey does allow use of servos with their code for circuit playground. If so how would we do that. If not do you plan on expanding the options next year?

We do, but it’s an advanced function that’s not available as a block. Depending on the size of the servo, you may need to use an addtional power supply or battery for the + and - servo connections. After connecting the data line to one of the pins on the Circuit Playground you can create a servo object using:

// servo connected to pin 2
var servo = new Servo(2);

You can then control the angle of the servo using or make it sweep back and forth using servo.sweep()

@Josh where can I find some of these advanced feature documentation. We are done with Unit 6 for CSD and I have 2 more months to go. I would love to challenge my kids with some additional resources. Any ideas?

I would also like the documentation for advanced features.

Thanks for the advantage feature! I was scouring the internet for resources but couldn’t find any except for python. That one group I was going to have work in python since the ones that want to use the servo are my advance students and it would be a good challenge to switch languages.

So we tried the following code

var degree;

var servo = new Servo(2);


degree = getNumber(“degree”);;


and used the following wire set up for are wires

orange to pin 2
brown to ground
red to 3v

it is saying servo or Servo is not declared.

What kind of servo are you using? Brand and model number if you have them.

@Josh and @bwalker How do we get access to the servo commands?
One of my student groups went ahead and bought a few components to start working on this. I did not find any information on Now they are trying to do it with CircuitPython. Any help from either of you is much appreciated.
Here is the servo and motor they have got.
Continuous rotation micro servo FS90R
CD/DVD Spindle motor