Assignment
Completion requirements
Assignment: Chase the Rabbit
Write a program (sketch) to have your Elegoo search for something that is within 1 meter of itself.
When a "target" is acquired it drives to the target and pushes it.
If the target moves the robot re-acquires and pursues again.
There is a fast rabbit (Jack) and a slower rabbit (Hopalong)
Start with Hopalong and master him first, then go for Jack.
Note: to add randomness:
Put this in void setup:
randomSeed(analogRead(0));
// so the sequence is different each time
Usage samples:
Forward(random(speed1,160));
// move forward an amount between speed1 and 160
Back(random(speed1,speed2));
// move back an amount between speed1 and speed2
// delay an amount between 300 and 600
Last modified: Friday, 28 April 2023, 10:14 AM