24
STEP1:
Plug the Crowtail-Motor Base Shield onto the Arduino or Crowduino board.
Hardware Connection
Code usage
Read the analog input of the thumb joystick. Why we don’t need to declare A4, A5 port as INPUT? As I
said before, because Arduino pins are the default input mode, when the pin is input, we do not need to
initialize the pin as input. Of course, you can also declare the pin as an input, which will be more
standardized and easier to understand for others.
Analog input: xValue = analogRead(A5); yValue = analogRead(A4);
We use 4 if statements to determine the values of the x and y axes so that we can print a direction
hint based on the position of the joystick. You may be confused by the value in the logical statement,
it is just the value that I distinguish and set when I observe the change in the value of the joystick
after changing the position of the joystick. So when you have a better idea, you can change your
value.
If Statements: if(logic statement) {code to be run if the logic statement is true}
Tower Pro SG90 is a high quality, low-cost servo for all
your mechatronic needs. It comes with a 4-pin power and
control cable, mounting hardware. Servo is used in many
intelligent situations, such as automatic doors, robots,
aerial models, etc.
It can be said that the servo is almost an indispensable
module in the field of intelligent control. Have you thought
about adding a rotatable part to your smart product, such as the robot's head and hands. In this
lesson, we will use servo and joystick to make a servo controller that allows you to use the joystick to
control the rotation of servo.
Lesson 11 – Servo control
Introduction
Arduino Uno/Crowduino Uno x1
Crowtail - Motor Base Shield x1
Crowtail - 9G Servo x1
Crowtail - Thumb Joystick x1
Crowtail - Cable x1
Required Parts
Summary of Contents for Crowtail Deluxe Kit
Page 47: ......