Hi,
I am entirely new to Arduino/Tinkercad and have some questions regarding a project I am trying to do. Ho,pefully this post is done correctly
The project:
I want the servo to spin randomly between 0-180, then when the push button is pressed I want it to randomly stop on either position 0, 50, 100, or 180, and the LED to light if stopped at 180.
The problem I have is to get the servo to stop at a random number if the push button is pressed. I guess I need to use Random () or randomSeed() but not sure how to do it.
Notice this forum software has the totally infuriating habit of removing important things from what you write?
Apparently as you have found, it does not do this once you have edited it, but since it also deletes more than one space between words and more than one blank line, I just add spaces and an extra line feed when I quote someone's one-line message.
Great, that I was able to help you. You no longer need the declaration of variables random_number and pos at the beginning. One time in void loop() is enough. And you wont longer need the variable pos in general.
Please note there is no such thing as a " void loop()". There is a function called " loop()". As a matter of definition it returns no parameter when called so it is first defined as " void". But you always refer to it as " loop()".