Hi all,
During the boot up and entry into Stage 1, it rotated more times than I expected it to. However, it ended up parked open. So that kind of worked.
Stage 2, clicking the perch switches did activate the food lid, however, like in the boot-up, it rotated more times than I expected it to. Also, it did not pause while open. Instead, it kept sliding back and forth halfway, and then eventually closed incrementally. So half correct.
During this loop, I could not change stages or do anything else. So I unplugged the Arduino and wanted to reset the EEPROM. I uploaded a simple sketch:
#include <EEPROM.h>
void setup() {
// put your setup code here, to run once:
// initialize the LED pin as an output.
pinMode(13, OUTPUT);
for (int i = 0 ; i < EEPROM.length() ; i++) {
EEPROM.write(i, 0);
}
// turn the LED on when we're done
digitalWrite(13, HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
}
And reuploaded the cros OS. Starting from Stage 1 again, everything still occurred like it did before (incorrectly, that is).
So I thought that perhaps I have received another faulty servo. I decided to run a test software on the Servo this time. I wanted the Servo to spin 180 degrees one way, and back again. I wanted this to be repeated in a loop. Here is the simple sketch I uploaded to the Arduino:
#include <Servo.h> // include servo library to use its related functions
#define Servo_PWM 9 // A descriptive name for D6 pin of Arduino to provide PWM signal
Servo MG995_Servo; // Define an instance of of Servo with the name of "MG995_Servo"
void setup() {
Serial.begin(9600); // Initialize UART with 9600 Baud rate
MG995_Servo.attach(Servo_PWM); // Connect D6 of Arduino with PWM signal pin of servo motor
}
void loop() {
Serial.println("0");// You can display on the serial the signal value
MG995_Servo.write(0); //Turn clockwise at high speed
delay(3000);
MG995_Servo.detach();//Stop. You can use deatch function or use write(x), as x is the middle of 0-180 which is 90, but some lack of precision may change this value
delay(2000);
MG995_Servo.attach(Servo_PWM);//Always use attach function after detach to re-connect your servo with the board
Serial.println("0");//Turn left high speed
MG995_Servo.write(180);
delay(3000);
MG995_Servo.detach();//Stop
delay(2000);
MG995_Servo.attach(Servo_PWM);
}
Is there an issue with the code? Perhaps it is the Arduino? Although the Ardunio is working with everything else. I am using the original Arduino Uno R3.
Please if anyone could help me, I would really appreciate it! I would like some input from the Crowbox team before I purchase a really expensive servo.
Thanks :)