Arnov Sharma
Published © GPL3+

Over Engineered TriGlow

TriaGlow is a Nanoleaf like setup but white. It's fully 3D Printed and controlled by a touchpad switch. (touch switch works in mid-air)

BeginnerFull instructions provided1 hour268

Things used in this project

Hardware components

PCBWay Custom PCB
PCBWay Custom PCB
×1
Arduino Nano R3
Arduino Nano R3
×1
Microchip Technology attiny13A
×1

Software apps and online services

Fusion 360
Autodesk Fusion 360
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

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

Story

Read more

Custom parts and enclosures

body

Lid

support/bush

Schematics

sch

Code

Triangular_light.ino

C/C++
int switchPin = 4;     //4         
int led1Pin = 0;        //0

int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by


int val;                        
int val2;                       
int buttonState;                
int Mode ; //= 0;              

void setup() 
{
pinMode(switchPin, INPUT_PULLUP);    
pinMode(led1Pin, OUTPUT);
buttonState = digitalRead(switchPin); 
}

void loop(){
 
      val = digitalRead(switchPin);      // read input value and store it in val
      delay(10);                         // 10 milliseconds is a good amount of time
      val2 = digitalRead(switchPin);     // read the input again to check for bounces
      
      if (val == val2) {                 // make sure we got 2 consistant readings!
        if (val != buttonState) {          // the button state has changed!
          if (val == HIGH) {                // check if the button is pressed
            if (Mode == 0) {         
              Mode = 1;               
            } else {
                if (Mode == 1) {       
                Mode = 2;           
            } else {
                if (Mode == 2) {     
                Mode = 3;           
            } else {
                if (Mode == 3) {     
                Mode = 0;  
           }
          }
         }
        }
       }
        }
          
        buttonState = val;                 // save the new state in our variable
      }

      // Now do whatever the lightMode indicates
      if (Mode == 0) {                       // FLIP FLOP
        digitalWrite(led1Pin, LOW);
      }

      if (Mode == 1) {
        analogWrite(led1Pin, brightness);
        brightness = brightness + fadeAmount;
        if (brightness <= 0 || brightness >= 255) {
    fadeAmount = -fadeAmount;
  }
      }

      if (Mode == 2) {
        digitalWrite(led1Pin, HIGH);
        delay(50);
        
      }
      if (Mode == 3) {
        analogWrite(led1Pin, 100);
        delay(50);
}
}

      
    

Credits

Arnov Sharma

Arnov Sharma

116 projects • 174 followers
Just your average MAKER

Comments