PaoloColonna
Published © GPL3+

DIY Heng Balance Lamp

A unique type of lamp that uses two magnets as switch to turn it on.

IntermediateShowcase (no instructions)1,527
DIY Heng Balance Lamp

Things used in this project

Hardware components

Arduino UNO Wifi Rev.2
Arduino UNO Wifi Rev.2
×1
SparkFun RGB LED Breakout - WS2812B
SparkFun RGB LED Breakout - WS2812B
×1
Jumper wires (generic)
Jumper wires (generic)
×1
magnet (generic)
×2
Phone Charger (generic)
×1
Switch Button
×1
Electrical Cables
×1
Scotch Tape
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Code

lampada.ino

Arduino
The code was made by using the Arduino’s library called FastLed.h. With this library you can command every led individually and select what colour you want them to show and the brightness.The code was made by using the Arduino’s library called FastLed.h. With this library you can command every led individually and select what colour you want them to show and the brightness.
#include <bitswap.h>
#include <chipsets.h>
#include <color.h>
#include <colorpalettes.h>
#include <colorutils.h>
#include <controller.h>
#include <cpp_compat.h>
#include <dmx.h>
#include <FastLED.h>


# define  NUM_LEDS  46
# define  NUM_STRIPS  1
# define DATA_PIN 6

CRGB leds[NUM_LEDS];
//CLEDController *Controllers [1];
int  gBrightness = 128 ;
//int Switch = 0 ;

int i;
void  setup () {
  // controllers [ 0 ] = & FastLED. addLeds <NeoPixel, 10 > (LED, 2);
  FastLED. addLeds <WS2812, DATA_PIN > (leds, NUM_LEDS);
  //pinMode(6, INPUT);

}

void  loop () {

  for (i = 0; i < NUM_LEDS; i++)
  {
    leds[i].r = 255;//green
    leds[i].g = 255; //red
    leds[i].b = 0;//blue
    delay(150);
    FastLED.show();
  }
}

Credits

PaoloColonna
0 projects • 0 followers

Comments