Building my own x-wing

dnalor

Well-Known Member
Ok..
After asking my friend Google :) i found this sketch.
It does almost everything what i want

The cockpit changes RGB..
A nice engine flicker.

i only need a steady light insert in it...that i'm working on..
But i also have an error in it.and didn't find the solution...(i still have to search)


Maybe somebody has the fix for the error?


int red = 11; //this sets the red led pin
int green = 10; //this sets the green led pin
int blue = 9; //this sets the blue led pin
int flickerLED = 8; // flicker on pin 8

int redNow;
int blueNow;
int greenNow;
int redNew;
int blueNew;
int greenNew;
int flickertime;

void setup()
{ //this sets the output pins
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(flickerLED,OUTPUT);
redNow = random(255);
blueNow = random(255);
greenNow = random(255);
redNew = redNow;
blueNew = blueNow;
greenNew = greenNow;
}

#define fade(x,y) if (x>y) x--; else if (x
void loop()
{
analogWrite(blue, blueNow);
analogWrite(red, redNow);
analogWrite(green, greenNow);
redNew = random(255);
blueNew = random(255);
greenNew = random(255);
// fade to new colors
while ((redNow != redNew) ||
(blueNow != blueNew) ||
(greenNow != greenNew))
{
fade(redNow,redNew)
fade(blueNow,blueNew)
fade(greenNow,greenNew)
analogWrite(blue, blueNow);
analogWrite(red, redNow);
analogWrite(green, greenNow);

flickertime = random(20);
digitalWrite(flickerLED,HIGH);
delay(flickertime);
digitalWrite(flickerLED,LOW);
delay(20-flickertime);
 
Z

Zathros

Ok..
After asking my friend Google :) i found this sketch.
It does almost everything what i want

The cockpit changes RGB..
A nice engine flicker....................

i only need a steady light insert in it...that i'm working on..
But i also have an error in it.and didn't find the solution...(i still have to search)


Maybe somebody has the fix for the error?

If you wrote; digitalWrite(13, HIGH); wouldn't it stay in that model till either shut off (powering down) or a : digitalWrite(13, LOW); to turn it off command?
 

imcold

Member
Is that the whole code? There are no no ending curly brackets  for the loop() function nor the while() block. And the #define looks unfinished. If I had to guess...

PHP:
int red = 11; //this sets the red led pin
int green = 10; //this sets the green led pin
int blue = 9; //this sets the blue led pin
int flickerLED = 8; // flicker on pin 8

int redNow;
int blueNow;
int greenNow;
int redNew;
int blueNew;
int greenNew;
int flickertime;

void setup()
{ //this sets the output pins
  pinMode(red, OUTPUT);
  pinMode(green, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(flickerLED,OUTPUT);
  redNow = random(255);
  blueNow = random(255);
  greenNow = random(255);
  redNew = redNow;
  blueNew = blueNow;
  greenNew = greenNow;
}

#define fade(x,y) if (x>y) x--; else if (x<y) x++;

void loop()
{
  analogWrite(blue, blueNow);
  analogWrite(red, redNow);
  analogWrite(green, greenNow);
  redNew = random(255);
  blueNew = random(255);
  greenNew = random(255);
  // fade to new colors
  while ((redNow != redNew) ||
    (blueNow != blueNew) ||
    (greenNow != greenNew))
  {
    fade(redNow,redNew)
    fade(blueNow,blueNew)
    fade(greenNow,greenNew)
    analogWrite(blue, blueNow);
    analogWrite(red, redNow);
    analogWrite(green, greenNow);

    flickertime = random(20);
    digitalWrite(flickerLED,HIGH);
    delay(flickertime);
    digitalWrite(flickerLED,LOW);
    delay(20-flickertime);
  }
}
 
Z

Zathros

You might want to take a working program, and modify it to get the results you wish. There's a face LED program on the Arduino site I'd start with. I am going to buy one of these. I was waiting for Raspberry PI for the Video functions, USB ports, keyboard, mouse etc. You can also write the code while it's running. Of course, here,in the "Land of the Free", it's not to be found! I wish someone would start a thread on this. I would, but i don't know what I am talking about. Maybe I'll just buy the Arduino.
 

dnalor

Well-Known Member
the problem is that the sketch was a working programm that i found of the internet :)
well...some of the lines has been lost i think..hum...with the copy paste..
i looked it over and found the error...
the first edition was ok and complete..
somebody put the flicker in the sketch..and lost some code-lines
And that i copied the first time ....but it is corrected and updated with ahum my own steady light line..it's not much but that is my drop of codec :-D

Now the soldering of the lights in the ship...


That raspberry sounds really great...a great price..
only that about the whole world wants one....and they can't produce that fast. (says wiki)

Maybe in a year they will be cloned and to be found everywhere..

final draft of the sketch file

int red = 12; //this is for the cockpit-r2 color red
int green = 11; //this is for the cockpit color green
int blue = 8; //this is for the cockpit-r2 color blue
int flickerLED = 10; // this for burning engines.
int steady = 13; // this the red main engine fire.

int redNow;
int blueNow;
int greenNow;
int redNew;
int blueNew;
int greenNew;
int flickertime;

void setup()
{ //this sets the output pins
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(flickerLED,OUTPUT);
pinMode(steady,OUTPUT);

redNow = random(255);
blueNow = random(255);
greenNow = random(255);
redNew = redNow;
blueNew = blueNow;
greenNew = greenNow;
}
#define fade(x,y) if (x>y) x--; else if (x<y) x++;
void loop()
{
analogWrite(blue, blueNow);
analogWrite(red, redNow);
analogWrite(green, greenNow);
redNew = random(255);
blueNew = random(255);
greenNew = random(255);
// fade to new colors
while ((redNow != redNew) ||
(blueNow != blueNew) ||
(greenNow != greenNew))
{
fade(redNow,redNew)
fade(blueNow,blueNew)
fade(greenNow,greenNew)
analogWrite(blue, blueNow);
analogWrite(red, redNow);
analogWrite(green, greenNow);
delay(20);
flickertime = random(20);
digitalWrite(flickerLED,HIGH);
delay(flickertime);
digitalWrite(flickerLED,LOW);
delay(20-flickertime);


//steady light for the engine
digitalWrite(steady, HIGH);

}
}
 

vbsargent

Member
Wow, this is VERY interesting. And tempting. I'm thinking of some lights for UHU's U-96 when I make it. It will have torpedoes, and I'm thinking about an interior to the conning tower, and possibly open hatches down to the control room with red night lights. And I'll enlarge to 1/72nd scale. This could give me the flicking red and green running lights as well as the steady red . . . . hmmmm . . . maybe both white AND red lights for the interior. They change for battle stations . . .
 
Z

Zathros

You are right about Raspberry PII, it is under manufactured. I have to read more on the Arduino, combined with the remains of my electronics lab will give me a way of connecting my son with all this stuff he is going to inherit, this can branch into making some kind of automaton in my machine shop, and pull him off the video games, but his own desire, not by a command.

Does the Arduino have any graphics capabilities? I am going to have to research this more. I like the idea of having breadboxes for different purposes, and moving the unit from circuit to circuit, and then finalizing a component, and making a circuit board.
 
Z

Zathros

This thread is also becoming a sticky. It has much information. Relevant, and pertinent! :)
 

dnalor

Well-Known Member
off course...

today i'm going to try to solder the first engine..
i ordered some more leds..
Also i'm working on some little parts

step by step...the x wing grows..
 

dnalor

Well-Known Member
Ok..

After some solding..hum is that english?..:)
i connected the leds with the cables...
i learned that i don't like that :)

But it looks nice..

for the other 3 engines i want to try to place the red in the middel.
but there is not much space.

http://www.youtube.com/watch?v=RpciI_cedM0
 

Attachments

  • engine6.jpg
    engine6.jpg
    156 KB · Views: 29
  • engine7.jpg
    engine7.jpg
    150.6 KB · Views: 27

Rhaven Blaack

!!!THE MAN BEHIND THE CURTAIN!!!
Staff member
Administrator
Moderator
It looks like this project is coming along very nicely.
The engine with the lights looks very good.
Thank you for sharing the video.
 

dnalor

Well-Known Member
And still it's just to big to slide in the xwing..
Now i need to make the hole larger :-(
 

dnalor

Well-Known Member
Engine two and three are burning...(only the leds) ;-)
I have some light leaking on the seams someting i think i can fix with some paper.

Also i'm starting with the guns..
But don't find a suitable support-rod...
The best i find is a large Mc donalds drinking straw..
But that only fits the tip..
The other parts i have to make them some thinker with paper.
 

Attachments

  • IMAG0508.jpg
    IMAG0508.jpg
    114.6 KB · Views: 21

dnalor

Well-Known Member
Ok..
Engine 4 has light..
Just making the diffuser and tonight installing the backside to the engine.
 

Attachments

  • engine9.jpg
    engine9.jpg
    160.9 KB · Views: 22
Top