Dial Controls Servo

Control servo motor in accordance with potention meter.


Let's use two parts this time.
Connect the potention meter and the servo motor to an obniz.

The potention meter should be connected to 0,1,2 and servo motor to 3,4,5.


The program is simple as it is a combination of what we have seen already.
This is the full code.

<!-- HTML Example -->
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src="https://unpkg.com/obniz@3.6.1/obniz.js"></script>
    <div id="obniz-debug"></div>
    <h1>Dial To Servo</h1>

      var obniz = new Obniz("OBNIZ_ID_HERE");
      obniz.onconnect = async function() {
        var meter = obniz.wired("Potentiometer", { pin0: 0, pin1: 1, pin2: 2 });
        var servo = obniz.wired("ServoMotor", { gnd: 3, vcc: 4, signal: 5 });
        meter.onchange = function(position) {
          servo.angle(position * 180);

After opening the HTML, the servo motor will move following the potention meter.
Perhaps the servo motor will rotate towards the opposite direction from the potention meter.
How would you change the direction of rotation? Please give it a thought.

Next : Two obniz integration

You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers


Visit our developer’s forum to discuss and discover technologies.



Feel free to contact out support and technical team.

Contact us