Hi Ladies and gentlemen!
I gonna keep it as short and simple as I possibly can.
Im going to make a mechanism that pour coffee powder in the coffeemaker.
for example
push button twice
it gives a value of 2
wait for lets say delay(1000)
servo starts swing(open and close a lid)
every swing subtract 1 until reaches 0 then close lid
i experimented around.. but guess im to new to figure out how to do it..
i have only used coding with Game maker.
anyway thanks in advance!
//
Andreas
What have you tried? What were the results? Post your best effort code and describe what the code actually does and how that differs from what you want.
Read the how to use this forum sticky to see how to post code and some advice on how to get the most from the forum.
Have you made SWEEP work?
bigred1212:
Have you made SWEEP work?
yes i made it work from examples i read, I guess my biggest from is the " If "
int K = 0; //K stands for coffee
let's say i push a button and K +=1
if (K >= 0);
{dö the servo thing and K-=1 until 0)
Do you have a sketch to count button presses already? Start with that. There must be lots of examples out there.
Beware of button bounce or a single press gives you a count of 5-10 or so.
wvmarle:
Do you have a sketch to count button presses already? Start with that. There must be lots of examples out there.
Beware of button bounce or a single press gives you a count of 5-10 or so.
Hi thanks for your answer! I can post my code when i come back home.. at work right now.
if (K >= 0);
This line of code say "if K is greater than or equal to zero then execute the next program statement or code block. So far, so good.
However, the semicolon on the end is the next program statement and is the only code conditionally executed as a result of the test returning true. Any code following this will be executed unconditionally.
Remove the semicolon