I guess I was watching a bit too much Star Trek with my brother. I decided to make a phaser.
Some of you may know that there are multiple types of phasers. I modeled mine after... Whatever it looks like:
I think I was going for Type 2 Phaser 2265, but it turned out a little different.
Here is a video on Youtube describing how it works and all of that.
Like I promised, schematics and pictures!
What you might see inside when you take apart a calculator:
You should mark down where you can solder the four wires:
Vcc, GND, = sign 1, = sign 2
This is just for fun: One dollar scientific calculator. The inside is a sheet of plastic as a PCB!
How did I build the Phaser?
I had this old scrap wood, it was triangle shaped. I asked my brother to sand it for me. He did an excellent job.
Then I cut an old cardboard tube in half (on an angle).
I found an old bottle cap and drilled a hole in it, for the trigger
Paint everything glossy black, glue it together neatly with hot glue.
Make the circuit, glue those things on too.
In the end I ended up with a pretty solid toy phaser.
If you have the schematic it should be pretty straight forward.
Here is the code:
http://txtup.net/HQ8Eg
Here it is also:
int
setting = PB2;
int
outled = PB0;
int
noisepin = PB4;
int
laser = PB1;
int
trigger = PB3;
int
clipsize = 6;
int
shotaken = 0;
int
noise;
int
noisend;
int
incrmnt;
int
brightness;
void
setup(){
pinMode(setting ,INPUT);
pinMode(outled ,OUTPUT);
pinMode(noisepin ,OUTPUT);
pinMode(laser ,OUTPUT);
pinMode(trigger ,INPUT);
for
(
int
brightness = 0; brightness < 255; brightness++){
analogWrite(outled, brightness);
delay(10);
}
if
(digitalRead(setting) == HIGH){
for
(
int
shotaken = 0; shotaken < clipsize;){
if
(digitalRead(trigger) == HIGH){
kill();
shotaken = shotaken + 1;
}
}
}
else
{
for
(
int
shotaken = 0; shotaken < clipsize;){
if
(digitalRead(trigger) == HIGH){
stun();
shotaken = shotaken + 1;
}
}
}
for
(
int
brightness = 255; brightness > 0; brightness--){
analogWrite(outled, brightness);
delay(5);
}
}
void
loop(){
digitalWrite(outled, LOW);
if
(digitalRead(trigger) == HIGH){
outofammo();
}
else
{}
}
void
stun(){
digitalWrite(laser, HIGH);
for
(
int
noise = 0; noise < 1000;){
digitalWrite(noisepin, 1);
delayMicroseconds(noise);
digitalWrite(noisepin, 0);
delayMicroseconds(noise);
noise = noise + 1;
}
digitalWrite(laser, LOW);
delay(100);
}
void
kill(){
digitalWrite(laser, HIGH);
for
(
int
noise = 2000; noise < 2500;){
digitalWrite(noisepin, 1);
delayMicroseconds(noise);
digitalWrite(noisepin, 0);
delayMicroseconds(noise);
noise = noise + 2;
}
digitalWrite(laser, LOW);
delay(100);
}
void
outofammo(){
for
(
int
blasted = 0; blasted <5; blasted++){
for
(
int
ammo = 0; ammo < 100; ammo++){
digitalWrite(noisepin,1);
delayMicroseconds(500);
digitalWrite(noisepin,0);
delayMicroseconds(500);
}
delay(30);
}
delay(100);
}
I hope it keeps it's formatting. Go have fun with it!