MakerWorld
Electronics
Voir le modèle
Automatic Nerf Target
1
Téléchargements
1
Likes
0
Makes
This is a Nerf target that automatically resets itself when you shoot it.For this project I use a simple 9-gram servo and a switch.If you want the version without the servo and switch mounts, click here:Nerf Target Servo Version Below is an example code. You will need to change the pin numbers depending on your wiring arrangement. #include <Servo.h>#define switchPin 2#define servoPin 3Servo myservo; // Create a Servo object to control the servoint pos = 90; // Variable to store the servo positionvoid setup() { myservo.attach(servoPin); pinMode(switchPin, INPUT); myservo.write(90); // Set servo to the starting position}void loop() { if (digitalRead(switchPin) == HIGH) { delay(1000); for (pos = 90; pos >= 0; pos -= 1) { myservo.write(pos); delay(5); } delay(2000); myservo.write(90); // Reset the target }}
Vous avez imprimé ce modèle ? Connectez-vous et partagez votre make !
Connectez-vous pour laisser un commentaire
Se connecterPas encore de commentaires – soyez le premier !