Skip to Main Content
Hands-On Internet of Things with MQTT
book

Hands-On Internet of Things with MQTT

by Tim Pulver
October 2019
Intermediate to advanced content levelIntermediate to advanced
350 pages
9h 5m
English
Packt Publishing
Content preview from Hands-On Internet of Things with MQTT

Testing the servo motor

Now that your network connection is working, as is the sending and receiving of MQTT messages, we need to do yet another mini-sketch to test whether the servo motor is working. Afterward, we will put the pieces of the puzzle together and create the code for our smart pet food dispenser.

To connect the servo motor, you need to connect the three cables of the servo to the Arduino. To connect the servo motor cable (with female pins) to the female Arduino pin headers on top, you can use the male-male jumper wire cables.

Connect the cables as follows:

  • Black (or brown): GND
  • Red: VCC
  • Orange (or yellow/green/white): Pin 9
Only three connections are needed to connect the servo: VCC, ground, and pin 9(this image was created ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical IoT Hacking

Practical IoT Hacking

Fotios Chantzis, Ioannis Stais, Paulino Calderon
Internet of Things (IoT) Fundamentals

Internet of Things (IoT) Fundamentals

Jerome Henry / Rob Barton

Publisher Resources

ISBN: 9781789341782Supplemental Content