Arnov Sharma
Published © MIT

Wand of Illumination

A Wand-themed Attiny13A Based Flash Light

BeginnerFull instructions provided1 hour123
Wand of Illumination

Things used in this project

Hardware components

PCBWay Custom PCB
PCBWay Custom PCB
×1
Microchip Attiny13
×1
Texas Instruments tp405
×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

Fusion360File

Schematics

SCH

Code

CODE

C/C++
const int switchPin = 4; 
const int lightPin = 0;
int lightMode = 1; 

void setup() 
{
    pinMode(lightPin, OUTPUT);
    pinMode(switchPin, INPUT_PULLUP);
    digitalWrite(lightPin, LOW);
     
}
void loop()
{ 
    if (digitalRead(switchPin) ==LOW) 
    { 
        lightMode = lightMode + 1;
        if (lightMode == 4)
        {
            lightMode = 1;
        }
    }
    if (lightMode == 1)
    {
        digitalWrite(lightPin, 50);
        delay(500);
    }
    else if (lightMode == 2)
    {
         analogWrite(lightPin, 250);
        delay(500);
    }
    else if (lightMode == 3)
    {
        analogWrite(lightPin, LOW);
        delay(500);        
    }
    //delay(200); // see text
}

Credits

Arnov Sharma
340 projects • 348 followers
Just your average MAKER
Contact

Comments

Please log in or sign up to comment.