Go Down

Topic: Arduino-controlled Nerf Pulse Rifle (Read 2445 times) previous topic - next topic

MrKrinkle

This is my first project using the Arduino. It's been a lot of fun and I wanted to share my experience.

The rifle is part of a "Space Marine" Halloween costume. To avoid being shot by the police, I figured some pulsating LEDs down the inside of the barrel would look pretty cool and hopefully make it safe... These are just some pictures and links of the little project:

This is a 'making of' video:
http://youtu.be/Ci9YRVWrUfI

And this is a short 'finished project' video:
http://youtu.be/9y6BOcJV0uE

I don't know. Plug it in and see what happens...

MrKrinkle

Also, this is the sketch code that makes the in and out fade:


Quote

int value;
int ledpin = 3;                        // light connected to digital pin 3
int ledpin2 = 6;                         //light connected to digital pin 6
int ledpin3 = 9;                           // light connected to digital pin 9
int ledpin4 = 11;                           // light connected to digital pin 11
long x=1;
void setup()
{
  // nothing for setup
}
void loop()
{   
  value = 128+127*sin(x*0.0174532925);   //Degrees to radians
  analogWrite(ledpin, value);            // sets the value (range from 0 to 255)
   analogWrite(ledpin2, value);           // sets the value (range from 0 to 255)
  analogWrite(ledpin3, value);           // sets the value (range from 0 to 255)
   analogWrite(ledpin4, value);           // sets the value (range from 0 to 255)
  if (x==360)
  {
    x==0;
  }
  delay(100);
   x += 1;
}


I don't know. Plug it in and see what happens...

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy