Let's Make Robots!

cpp

Trying to encapsulate a servo instance, no movement

Hi there,

I'm having an issue with encapsulating servo functionality in its own class. What I want to do is creating a class that contains a couple of methods that control a servo more or less autonomously, in such a way that just requires me to set the context and then in the loop calling myservo.update() to have the myservo class take care off its own. Very OOP indeed :-)

For some reason I just can't get it to work. Brought down to the bare minimum, I have three source files, main.ino (off course), myservo.h and myservo.cpp:

myservo.h contains this:

Code Repository!

Can we get everyone who has got their code to successfully run to post their files here? Ive been looking all over the site for a central area for code, and I cannot find one. If there is one, point me in that direction, if not, lets all start posting here!

Try not to paste lines of code here, lets keep it clean. uploaded files only please!

Format:

Name of code,

What it's for

File (zip or IDE compatible file)

 

What do you guys think?