Dial controls Servo Motor

Control servo motor in accordance with potention meter.

Connect

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

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

Program

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

<!-- HTML Example -->
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <script src="https://obniz.com/js/jquery-3.2.1.min.js"></script>
  <script src="https://unpkg.com/obniz@3.3.0/obniz.js"></script>
</head>
<body>

<div id="obniz-debug"></div>
<h1>Dial To Servo</h1>

<script>
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);
  };
}
</script>
</body>
</html>

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