loop_tail() the name of the loop you want to run when the case number is randomly picked.case 0: the number assigned to the loop which will be called upon with the switch command, if you add another loop to be controlled it would be case 1, followed by case 2 and so on. switch (randNum) switches between the cases listed.byte randNum = random(3) creates a max range of random numbers that can be assigned.void loop() this is where you'll list all the servo loops you created to be triggered at random.tail.attach(9) attaches the servo on pin 9, each servo would get a line of code attaching it to its own pin.void setup() is run one to setup your board and pins.delay(t3) pauses movement for a random amount of time according to the range defined in int 3.tail.write(0) resets the servo to its neutral starting position.delay(t2) pauses movement for a random amount of time according to the range defined in int 2.tail.write(t1) sets the servo to a random position according to the range defined in int t1.int t3 = random(400, 1000) defines variable and sets neutral random delay in microseconds.int t2 = random(500, 800) defines variable and sets random delay in microseconds.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |