Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Pablo García edited this page Apr 24, 2018 · 1 revision

Moves the shaft of the mini servo between 10º and 170º. On a continuous rotation servo, it moves in one direction and the opposite.

This example makes use of the ZUM Junior library.

Hardware Required

  • ZUM Junior Board
  • Mini servo

Circuit

Code

#include <BQZUMJunior.h>
#include <BQZUMJuniorPorts.h>
#include <Servo.h>

//ZUM Junior Servo connedted to port 2. ATTENTION-> Servo is on wire 1.
const uint8_t pinServo = BQ::ZUMJunior::ports[2][1];
Servo servo;
void setup() {
  // put your setup code here, to run once:
  servo.attach(pinServo);

}

void loop() {
  servo.write(10);
  delay(1500);
  servo.write(170);
  delay(1500);
}

Clone this wiki locally