DAGU Playful Puppy Instruction Manual page 15

Hide thumbs Also See for Playful Puppy:
Table of Contents

Advertisement

Understanding the code (cont.)
If you are new to Arduino then a guide to all the main commands and functions can be found by going to help and
selecting reference.
The first tab is the main program. In the beginning the <Servo.h> library and definitions are added. Then global
variables and servos are defined.
The setup() function runs only once when the program first runs. This is where the servos are attached to their digital
pins and initialized to their center positions. By default, all digital pins are configured as inputs on startup as a safety
precaution. The pinMode() command is used here to reconfigure the IRleds pin to become a digital output so it can
control the IR LEDs on the compound eye.
The loop() function is the main section of code. As the name suggest, this code is run repeatedly until the processor
is reset or turned off.
15

Advertisement

Table of Contents
loading

Related Products for DAGU Playful Puppy

Table of Contents