Im looking to write some code and before i do im just looking to see if something is available before i take on this laborious task.
My intentions are:
im looking to hook up a button so that when the button is pushed (not held) it will execute a sequence to run servos 'until sequence is finished.
Then if the button is pushed again its to run another pre-defined sequence. pushed again it then runs the first sequence again. and so on…
any tips, code or examples will be greatly appreciated.
There is code in the Phoenix code base for running sequences. The code is probably a lot more complex than what you need, as we added stuff to it, to try to allow us to change the speed of the sequence (and direction) of the sequence while it was playing.
The code that actually talks to the SSC-32 is in the code Phoenix_Driver_SSC32.h The code for handling buttons being pressed, there are examples in the different input code classes (PS2, DIY remote, Commander).
Again this code could be simplified a lot, if you simply want to start a sequence, with maybe some other interlocking code that checks to make sure it is not in the middle of a sequence…
Thanks for the pointers there.
i was in a previous code using the SwitchCase statement but i have just written another simpler version…
This version either determines whether the button is held or not.
but i need to allow the button to count an array of pushes so that the button gets pressed/debounce then runs a sequence, then the next time its pressed/debounced it runs a second sequence.?
[code]#include <Servo.h>
Servo servo1;
Servo servo2;
#define button 3 //attaches button to pin 3
int STORE = 0; //STORE is used to store state of input
//Initial Servo Position
int servo1_Pos = 90;
int servo2_Pos = 90;
Thanks Kurte.
well im now using this and as far as i can tell its working. but thats a blind assumption as i dont acctually have the board powered at the moment.
Such a dear devil i know. lol
[code]#include <Button.h> #include <Servo.h>
//====================— I N N E R B R E E D F X —=========================
//Project; Animatronic hand for InnerbreedFX
//Description: Control for Jonny Poole - InnerbreedFX Animatronics
//Software version: V1.0
//Date: 30-09-2013
//Developer/s: Jonny Poole
//
//
//=============================================================================
//Initial Servo Position
int Thumb1_Pos = 90;
int Thumb2_Pos = 90;
int Index_Finger_Pos = 90;
int Pointing_Finger_Pos = 90;
int RingAndPinky_Finger2_Pos = 90;
int RingAndPinky_Finger1_Pos = 90;
int Wrist_Pos = 90;
Eric, the code allows me to set predefined servo positions, and then by pushing the button, it selected each group of positions set.
ok well i managed to solve my previous requirements but rather than opening another thread i thought id post my next requirement to see if anyone has any detail.
Im looking to have a sequence that’s runs once when power is applied, but then doesn’t loop or get called again until the program is restarted from a power up?
Any info on how this can be achieved would be great.