Arnov Sharma
Published © LGPL

PCB Heart Necklace

Made a heart-shaped PCB Necklace for a special one <3

BeginnerFull instructions provided1 hour865

Things used in this project

Hardware components

Microchip attiny84
×1
Arduino Nano R3
Arduino Nano R3
×1
PCBWay Custom PCB
PCBWay Custom PCB
×1

Software apps and online services

Fusion
Autodesk Fusion

Story

Read more

Schematics

sch

Code

code

C/C++
const int switchPin = 7; 
int pinsCount=6; 
int pins[] = {0,1,2,3,4,5};
int lightMode = 1; 
void setup() 
{
    pinMode(0, OUTPUT);
    pinMode(1, OUTPUT);
    pinMode(2, OUTPUT);
    pinMode(3, OUTPUT);
    pinMode(4, OUTPUT);
    pinMode(5, OUTPUT);
    pinMode(switchPin, INPUT_PULLUP);
    //digitalWrite(switchPin, HIGH); // internal Pull-up enabled
}
void loop()
{ 
    if (digitalRead(switchPin) ==LOW) 
    { 
        lightMode = lightMode + 1;
        if (lightMode == 4)
        {
            lightMode = 1;
        }
    }
    if (lightMode == 1)
    {
        digitalWrite(0, HIGH);
        digitalWrite(1, HIGH);
        digitalWrite(2, HIGH);
        digitalWrite(3, HIGH);
        digitalWrite(4, HIGH);
        digitalWrite(5, HIGH);
        delay(300);
    }
    else if (lightMode == 2)
    {
        digitalWrite(0, LOW);
        digitalWrite(1, LOW);
        digitalWrite(2, LOW);
        digitalWrite(3, LOW);
        digitalWrite(4, LOW);
        digitalWrite(5, LOW);
        delay(300);
    }
      else if (lightMode == 3)
       {
       for (int i=0; i<pinsCount; i=i+1){    // chasing right
       digitalWrite(pins[i], HIGH);         // switching the LED at index i on
       delay(90);                          // 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(90);                          // stopping the program for 100 milliseconds
       digitalWrite(pins[i], LOW);          // switching the LED at index i off
      }
    }
}

Credits

Arnov Sharma

Arnov Sharma

308 projects • 306 followers
Just your average MAKER

Comments