Moduled the multipurpose lamp
Moduled is a multipurpose lamp for people who are in need of different functions, forms, and colors of lighting. It is composed of trapezoidal modules. The white module is where Luxeon high intensity LEDs, heat sinks, BlinkM RGB LEDs, on/off switch, battery pack, rare earth neodymium magnets, Arduino, 3 potentiometers (one to control white LED brightness, one to control hue of RGB LEDs, and one to control brightness of RGB LEDs) are. The white module is the main part that provides the light according to the user’s desires. The black trapezoidal modules also contain rare earth magnets to stick to the white module. The black modules are supplementary to the white module so that different forms of lamps (standing lamp, desk lamp, night lamp, etc.) can be created. Now, with moduled, people can take apart or build lamps out of simple trapezoidal figures and create whatever color and brightness of light they need.
The code below uses blinkM’s .h file that can be downloaded here
#include "Wire.h" #include "BlinkM_funcs.h" const int blinkm_addr = 0; const int hue_pot_pin = 0; //pin0 const int bri_pot_pin = 1; //pin1 int lightControl = 2; //pin2 int lightVal = 0; int ledPin[] = { 3,6,9,10,11}; void setup() { Serial.begin(19200); BlinkM_beginWithPower(); BlinkM_stopScript(blinkm_addr); // turn off startup script Serial.println("BlinkMKnobHue ready"); for(int i = 0; i < 5; i++){ pinMode(ledPin[i], OUTPUT); } } void loop() { int hue_val = analogRead(hue_pot_pin) / 4; int bri_val = analogRead(bri_pot_pin) / 4; Serial.println(hue_val); BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val); delay(20); whiteLight(); } void whiteLight(){ lightVal = analogRead(lightControl); int ledVal = map(lightVal, 0, 1023, 0, 255); for(int i = 0; i < 5; i++){ analogWrite(ledPin[i], ledVal); int hue_val = analogRead(hue_pot_pin) / 4; int bri_val = analogRead(bri_pot_pin) / 4; BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val); delay(20); } }
Reply