wow... great info... lots to digest! Please let me say I am learning a lot and figuring out a lot at the same time! this is awesome, fun, and rewarding!
Feeling a little better about my project knowing I an not a "complete fool"
Lol, not a fool at all !
By the way, the debouncing example you mentionned some time ago also uses the same "elapsed time measurement" technique.
Eric
void sweeperUp() { // move sweeper to the up position pwm.writeMicroseconds(sweeperVerticalMotorPin, 1474); }
so is this method essentially creating variables or constants... the word void just throws me off...
So what was frustrating originally was the PCA9685... because the PCA9685 is the actually "object" so you have to address each pin by their actual PIN number to get the servos to work independently of each other.
I think one response above had suggested using some 'define' statements to handle the pin numbers of the PCA9685 for each servo, but you could also equate your values for the travel limits of each servo to some variable name. Such as:
// Using a more descriptive name for the servos
define sweeperlift 0
// Obviously other servos have to be defined as well
// just using one for this example
// Now the assignment of position values
int SweeperUp=1474;
int SweeperDown=1978;
// Then somewhere further down in your code
pwm.writeMicroseconds(sweeperlift,SweeperUp);
// or to lower the sweeeper it would be just 'SweeperDown'
// instead of 'SweeperUP'
These are somewhat longer variable names, but it makes it easier to understand the code and almost makes it self documenting.
SteveG
ok that makes sense... and as you said essentially the readability...
not sure if should go making those changes now but for now this will be really useful for the future!!!
the word void just throws me off..
The void is there because no values are being returned from the function being defined.
Sometimes when you define a function you might expect some value to be returned to you when the function is called and then you would declare the type of variable being returned. Here we expect no return value, so we use the type 'void.'
If you were defining a function to find the square root of a number it might start off like this:
float squareroot(number){
//rest of the code goes here;
}
Here we have used 'float' type instead of 'void' type. Hope that helps
SteveG
not sure if should go making those changes now but for now this will be really useful for the future!!!
No I wouldn't go making those changes now, but something for the future,
SteveG
ok so yes that does make more sense now! Always learning thank you!
I did not find the drone bot workshop video just yet but found one from How to Mechatronics. So not saying I will install just yet... just learning and thinking... for my application you are thinking to use it as a distance/proximity measurement rather the counting/ assessing rotation?
The most exciting thing about this forum is how it brings us all together from different parts of the world, from different cultures, each with our own experiences, but with a common goal, and that is to learn.
I don't think I have you @dundervetter, is it Jason, placed on the globe yet, but @robo-pi, James, is in the US in Pennsylvania, is that right James? @pugwash, SteveC, is in Germany. @zerferby, Eric, is in France. Our leader @dronebot-workshop, Bill, is in Canada, And I'm in the US in Georgia.
This forum has folks from all over the world!
SteveG
The most exciting thing about this forum is how it brings us all together from different parts of the world, from different cultures, each with our own experiences, but with a common goal, and that is to learn.
This is awesome!
This forum has folks from all over the world!
Conspiracy, taking the world over ! ?
Eric