You will need the following Arduino libraries to write the Arduino sketch to control two motors for detecting the track:
- SparkFun line follower Array Arduino library
- Adafruit Motor Shield V2 library: Download it from https://github.com/ladyada/Adafruit_Motor_Shield_V2_Library/archive/master.zip
Listing 5-1 shows a snippet from the complete Arduino sketch that you can use to upload to the Feather HUZZAH ESP8266 board. The complete code can be found in the example code file of this chapter:
#include "ESP8266WiFi.h" #include <Wire.h> #include <Adafruit_MotorShield.h> #include "sensorbar.h" //SparkFun line follower array Arduino library // Create the motor shield object with the default I2C address Adafruit_MotorShield AFMS = Adafruit_MotorShield(); // And connect 2 DC motors to port M3 & M4 ! Adafruit_DCMotor *L_MOTOR = AFMS.getMotor(4); Adafruit_DCMotor *R_MOTOR = AFMS.getMotor(3); // Uncomment...