MakerWorld
Electronics
Zum Modell
Automatic Nerf Target
1
Downloads
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 }}
Hast du dieses Modell gedruckt? Einloggen und dein Make teilen!
Melde dich an, um einen Kommentar zu hinterlassen
AnmeldenNoch keine Kommentare – sei der Erste!