WOLFRAM SYSTEMMODELER

MoveServo

Using servos

Diagram

Wolfram Language

In[1]:=
Click for copyable input
SystemModel["ModelPlug.Examples.MoveServo"]
Out[1]:=

Information

Hardware Components Used

  • 1 Arduino
  • 1 5 V servo
  • 1 external 5 V power source

Description

This example shows how to control a servo by using the Servo component. You can find the diagram in the following figure.

For this example, it is recommended to use an external power source to provide voltage for the servo. This is because the power from the Arduino may not be sufficient. If you are unsure how to connect your servo, take a look at the reference in the Arduino Playground.

Servos are controlled with a signal in the range of 0 to 1, where 0 corresponds to 0 degrees of rotation and 1 to 180 degrees. This example makes the servo bounce from 0 to 180 degrees until it gets stable around 90 degrees.

Components (3)

arduino

Type: Arduino

servo

Type: Servo

expSine

Type: ExpSine