Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Arnov Sharma
Published © GPL3+

Just a Regular OverEngineered FlowerPot

Made a Flower Pot by combining PCBs together, the whole setup is powered by an Atmega328PU, and it's basically a Decorative lamp.

BeginnerFull instructions provided1 hour216

Things used in this project

Hardware components

ATmega328
Microchip ATmega328
×1
PCBWay Custom PCB
PCBWay Custom PCB
×1

Software apps and online services

Fusion
Autodesk Fusion
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Vase

Schematics

sch

Code

code

C/C++
const int switchPin = 2; 
int pinsCount=5;                        // declaring the integer variable pinsCount
int pins[] = {3,5,6,9,10};
int lightMode = 1; 

int led = 11;           // the PWM pin the LED is attached to
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by

void setup() 
{
  pinMode(3, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(switchPin, INPUT_PULLUP);
  pinMode(led, OUTPUT);
  digitalWrite(3, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
     
}
void loop()
{ 
    if (digitalRead(switchPin) ==LOW) 
    { 
        lightMode = lightMode + 1;
        if (lightMode == 3)
        {
            lightMode = 1;
        }
    }
    if (lightMode == 1)
    {
        digitalWrite(pins[3,5,6,9,10], LOW);
        delay(1000);
    }
    else if (lightMode == 2)
    {
      for (int i=0; i<pinsCount; i=i+1){    // chasing right
      digitalWrite(pins[i], HIGH);         // switching the LED at index i on
      delay(70);                          // stopping the program for 100 milliseconds
      digitalWrite(pins[i], LOW);          // switching the LED at index i off
    }
      for (int i=pinsCount-1; i>0; i=i-1){   // chasing left (except the outer leds)
      digitalWrite(pins[i], HIGH);         // switching the LED at index i on
      delay(70);                          // stopping the program for 100 milliseconds
      digitalWrite(pins[i], LOW);          // switching the LED at index i off
     }
    }
       analogWrite(led, brightness);
       brightness = brightness + fadeAmount;
       if (brightness <= 0 || brightness >= 255) {
    fadeAmount = -fadeAmount;
  }
  delay(30);
    //delay(200); // see text
}

Credits

Arnov Sharma
310 projects • 311 followers
Just your average MAKER

Comments