Hey all. I am trying to create a library which cooridinates the control of sereral servos. I am having an issue where on initialization the servo goes to the stop, and then hums as if still trying to go beyond it. I know for a fact it is not a servo issue since I can upload other code I have written and they behave just fine. I am guessing it is in the way I am implementing the library, but after several hours of staring at it I am at a total loss. Here is the bare bones of my code:
Controller.h
#ifndef Controller_h
#define Controller_h
#include "Arduino.h"
#include "Servo.h"
class Controller
{
private:
int _rear_pin;
Servo _rear_motor;
public:
Controller(int);
};
#endif
Controller.cpp
#include "Arduino.h"
#include "Servo.h"
#include "Controller.h"
Controller::Controller(int a){
_rear_pin = a;
_rear_motor.attach(_rear_pin);
//delay(1);
}
Main Sketch
#include "Servo.h"
#include "Controller.h"
Controller go(9);
void setup(){}
void loop(){}
It is worth noting that if you uncomment the delay statement in .cpp the humming issue is resolved, with the remaining issue that no other commands (i.e. .write()) work. Any help or suggestions are appreciated.