Go Down

Topic: First completed project. (Read 525 times) previous topic - next topic

twelch

I started a little while ago with arduino because it seemed like a good place to start to create this project....


I ended up making a dozen these, and development was all done with my Arduino Uno. also decided to learn to make my own PCBs in the process


I would love to show it working but the light from the rose prevents it. The rose was carved with a shopbot then cast from silicone rubber. LED strip light behind it glow white until a magnet(mine are embeded in paint brushes) passes the reed sensor in the center, at wich point if fades to pink and if you do it again to red. The concept it "Painting the Roses Red" from Alice in Wonderland

Here is the code (and im sure there are thing i could have done different or more efficiantly )
Code: [Select]
//variables
const int RedPin = 10;
const int BluePin = 11;
const int GreenPin = 9;
const int Button = 7;
int Fade = 0;
int RedLevel = 255;
int BlueGreen = 255;
int loopCount = 0;
int intro = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(Button, INPUT);
  pinMode(RedPin, OUTPUT);
  pinMode(BluePin, OUTPUT);
  pinMode(GreenPin, OUTPUT);
  analogWrite(RedPin, 0);
  analogWrite(BluePin, 0);
  analogWrite(GreenPin, 0);
  for(intro=0; intro < 255; intro++)
  {
    analogWrite(RedPin, intro);
    delay(5);
  }
  for(intro=0; intro < 255; intro++)
  {
    analogWrite(RedPin, 255-intro);
    delay(5);
  }
  for(intro=0; intro < 255; intro++)
  {
    analogWrite(BluePin, intro);
    delay(5);
  }
  for(intro=0; intro < 255; intro++)
  {
    analogWrite(BluePin, 255-intro);
    delay(5);
  }
  for(intro=0; intro < 255; intro++)
  {
    analogWrite(GreenPin, intro);
    delay(5);
  }
  for(intro=0; intro < 255; intro++)
  {
    analogWrite(GreenPin, 255-intro);
    delay(5);
  }
  for(intro=0; intro <255; intro++)
  {
    analogWrite(RedPin, intro);
    analogWrite(BluePin, intro);
    analogWrite(GreenPin, intro);
    delay(5);
  }
}

void loop()
{
Serial.println(loopCount);
loopCount ++;
if (loopCount <= 3000);
{
  if ((digitalRead(Button) == HIGH) && (Fade == 0))
  {
    loopCount = 0;
    for(int count=0; count <170; count ++)
    {
     analogWrite(RedPin, RedLevel);
     analogWrite(BluePin, BlueGreen);
     analogWrite(GreenPin, BlueGreen);
     BlueGreen --;
     delay(5);
    }
    Fade ++;
  }
  if ((digitalRead(Button) == HIGH) && (Fade == 1))
  {
   loopCount = 0;
   for(int count=0; count <85; count ++)
   {
    analogWrite(RedPin, RedLevel);
    analogWrite(BluePin, BlueGreen);
    analogWrite(GreenPin, BlueGreen);
    BlueGreen --;
    delay(10);
   }
   Fade ++;
  }
  if (BlueGreen == 0)
   {
    BlueGreen = 255;
    delay(10000);   
   }
  if (Fade == 2)
  {
   for(int fadeout = 0; fadeout < 255; fadeout ++)
   {
     analogWrite(BluePin, fadeout);
     analogWrite(GreenPin, fadeout);
     delay(10);
   }
   Fade = 0;
  }
}

if (loopCount > 3000)
{
  loopCount = 0;
  Fade = 0;
  for(BlueGreen; BlueGreen <255; BlueGreen ++)
   {
    analogWrite(RedPin, RedLevel);
    analogWrite(BluePin, BlueGreen);
    analogWrite(GreenPin, BlueGreen);
    delay(10);
   }
}
}

wanderson

Very cool first project.  Quite impressive for a beginner to go straight to learning to make your own boards during your first project!
New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 1.0.1

twelch

I took C++ programming in high school but that was a long time ago. The PCB etching honestly doesn't seem like a terribly complicated process. I did spend hours on the layout but  Fritzing made it a lot easier to understand what i was doing

Electropepper

Congrats, it is indeed a very successful first project considering you built your own PCB so you really understand what is arduino.
I like it a lot  :D.

Go Up