Go Down

Topic: Need some help with millis  (Read 131 times) previous topic - next topic

Orbilo

Hello,
I currently doing a project in my school and I have some problems with millis, how long the button is pressed.
I'm completely desperate  :smiley-confuse:  , I'm working on this for more than 4 weeks. I did it before with delay() it was really long and almost done ,but my project-professor? said it's not so good and I should do it differently.(+ there was a bug I couldn't find out how to solve it).
I'm still a noob in Arduino and my native language is not english , so sorry for my mistakes , I'm trying my best  :)
I'm  going to explain what it should do.

1.When you upload the code it should say in the Serial.print the value "0".

2.When the button is pushed for less than ~ 0,1-1 seconds the Serial.print should say the value "10".
When the button is pressed again for less than ~ 0,5-1 seconds it should get "0" again.
Like a "light switch."

3.When the button is pushed for less than ~ 0,1-1 seconds the Serial.print should say the value "10".
When the button is pressed again for example 4 seconds  it should get "6" .
When you press it again it should say "0".

4.When the button is pressed for example for 5 seconds the Serial.print should say the value "5".
When the button is pressed for example 2 seconds Serial.print should say "3".
When you press it again it should say "0".

5. The max value it can get is 10, so if you would press it for 20 seconds it should be 0 again ( 15 seconds would be 5 etc.)

I hope you can help me :)

robtillaart

Can you post the code you have created already (as we want to help but are not doing your homework)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy