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 © LGPL

PCB Necklace V1

Made a wearable Small Necklace or pendant with custom Tear shaped PCB and Attiny13A

BeginnerFull instructions provided1 hour612

Things used in this project

Hardware components

Microchip Attiny13A
×1
PCBWay Custom PCB
PCBWay Custom PCB
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

sch

Code

code

C/C++
const int switchPin = 4; 
int pinsCount=4;                       
int pins[] = {3,2,1,0};   
int lightMode = 1; 

void setup() 
{
    pinMode(0, OUTPUT);
    pinMode(1, OUTPUT);
    pinMode(2, OUTPUT);
    pinMode(3, OUTPUT);
    pinMode(switchPin, INPUT_PULLUP);
   digitalWrite(0, LOW);
   digitalWrite(1, LOW);
   digitalWrite(2, LOW);
   digitalWrite(3, LOW);
     
}
void loop()
{ 
    if (digitalRead(switchPin) ==LOW) 
    { 
        lightMode = lightMode + 1;
        if (lightMode == 3)
        {
            lightMode = 1;
        }
    }
    if (lightMode == 1)
    {
        digitalWrite(pins[0,1,2,3], LOW);
        delay(200);
    }
    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
     }
    }
        
    //delay(200); // see text
}

Credits

Arnov Sharma
310 projects • 311 followers
Just your average MAKER

Comments