My project this week is literally a finger pointer. It is flat and moves 360 degrees and points to a location randomly. Ideally there would be people around in a circle and when I click the reset button it will turn and point randomly to one person.
I made it more appealing by accelerating the rotation from rest to a high speed and made it random by varying the acceleration randomly by changing the delay value.
Here’s a video of it working:
I’ve also attached the code I used:
const int motorPin = 9; void setup() { pinMode(motorPin, OUTPUT); Serial.begin(9600); motorAcceleration(); } void loop() { } void motorAcceleration() { int speed; int delayTime = random(5,25); for(speed = 0; speed <= 255; speed++) { analogWrite(motorPin,speed); delay(delayTime); } for(speed = 255; speed >= 0; speed--) { analogWrite(motorPin,speed); // set the new speed delay(delayTime); // delay between speed steps } delay(1000); }