I have been trying something very similar to get the Parallex 360 feedback servo to work for a motorized blinds project. The problem that I am running into with the code provided by Parallex is that it is written in Propeller C, and "cog_run" within the main function is not recognized by Arduino.
cog_run(feedback360, 128); // Run feedback360 in a cog
cog_run(control360, 128); // Run control360 in a cog
First of all, what is cog_run anyway?
Second, is there an equivalent of cog_run in Arduino?
I see that aldeba has modified the feedback360 function to return a value of "theta"(in my case I would be using the "angle" variable seen in MatMax's post from the original Parallex code instead since my rotations can be =>360 degrees, and "theta" is only valid from 0-359).
Last question is how would you call and structure the theta/angle variables (which is in the feedback360 function) with the servo.write() function so that theta/angle is continuously being read and updated as the servo moves? Can I just run the feedback360 function as seen below and the angle variable will get updated every time it loops? Or do I have to modify the feedback360 function so that it returns an "angle" value similar to what aldeba did?
This is part of what I have so far in my blinds going up function:
void blindsup() {
myservo.attach(13); //servo attached to control pin 13
while (angle < up) { //up defined as angle in which the blinds are up
myservo.write(0); //my comments: move the servo in one direction
feedback360(); //run the function feedback360()
Serial.println(angle); //
}
myservo.write(90);
myservo.detach();
}
Any help would be greatly appreciated!!!