Page 1 of 1

How to call random functions in Arduino

How to call random functions in Arduino

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.




RSS Feed

Home Forums Software Miscellaneous Software How to call random functions in Arduino

Tagged: , ,

This topic contains 2 replies, has 2 voices, and was last updated by  hans 2 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • 7283

    jacchavez
    Participant

    Hello!

    Thank you so much for your neat little page on LED effects! I might as well tell you my main goal on here. I would like to program the arduino to rotate a little servo motor that will be connected to a “disco ball” of LED’s. I would like different effects to be called each time I turn on the arduino. (I will be attaching it to a 9V battery with a switch.) I have tried to use random numbers to call your functions, but I cannot get it to work. I have included the LED effects attachment as well as the servo attachment. I would like to know how I call a random function but also call the servo function no matter which LED function gets chosen.

    Attachments:
    7292

    jacchavez
    Participant

    Ok, I’ve got it.

    Turns out I shouldn’t code at 4 in the morning after a long hard day. I’ve come up with this code. The servo function is hard coded, but there’s no shame in writing a function that works!

    Attachments:
    7297

    hans
    Keymaster

    Haha, coding at that time of day can have it’s consequences hahah 

    Sorry for the late reply though – I am in the middle of moving from Europe to the US, and it’s been quite busy, not to mention: all my stuff is in a huge container somewhere on the ocean haha.

    Glad you figured it out though – and thanks for sharing the code. 

Viewing 3 posts - 1 through 3 (of 3 total)



You must be logged in to reply to this topic.