La Bougie (blinkm via rotary encoder)

With this code you can control your RGB mood light simply via one rotary controller which you can fit in your wall next to the other light dimmers.

What does the code do now:

  • You can turn the knob to change brightness or Hue
  • Push the button to select between menu's
    1=Brightness
    2=Hue
    3=Random
    4=BlinkM preset
    5=Power off
  • Get informed at which menu you are on, blink once, or twice.
  • power a led to simulate a relais for powering an external driver
  • Turn external power supply (for power leds) on and off

The future add-ons I have in mind are:

  • Turn back to menu 1 of not touched the controller for x sec.
  • Network control (ethernet shield)
  • IR control
  • Sound control
  • Program a few presets
  • A Nice Display to see all the information on.

Presets I had in mind are:
Random (Randomize Colours)
Sundown (change between red and orange/yellow)
IceAge (blue and white's)
Sound (Respond to sound/frequency)

As I use blinkm's I also want to use the blinkm address space to fancy it up.

Code PART 1

/* --------------------------------------------------------------------
Welcome to La Bougie v 1.7  2009-06-20
A controller for RGB Lightning using BlinkM
Connect a rotary controller with common gnd
A      to digital pin 7
B      to digital pin 8
switch  to digital pin 5

menu  1 : Controlling Brightness
menu  2 : Controlling Hue
menu  3 : Going random, with controlled brightness
menu  4 : Run a pre-programmed BlinkM scene from memory
menu  5 : Turn the lights and external driver off via relais_pin
-------------------------------------------------------------------- */


#include "RotaryEncoder.h"
#include "Wire.h"
#include "BlinkM_funcs.h"
#include <Ethernet.h>


#define blinkm_addr 0x00
int my_menu = 0;                        // The first menu to start with (has to be 0 for now)
int my_hue = 128;                       // Default hue at startup
int my_hue_random= 100;                     // just to initialize, it will get random in the code
int my_brightness = 250;                // Default brightness at startup
int my_power = false;                   // false will eventually disable an external driver for power-leds
int my_power_history = false;
int my_blinkm_program = 10;             // Pre-programmed blinkm program between 0..18 (I think) datasheet is not accurate
int my_information = false;
int relais_pin = 6;                     // a reserved port for a relais that triggers the driver for the power-leds
int when_to_randomize_counter = 0;      // counter needed to calculate when to random
int when_to_randomize = 100;            // increase to change cycles between randomize in menu 3
int intro = false;
byte bri_val;
byte hue_val;

// Fadespeed that BlinkM uses to fade between colours (1=slowest, 255=instant, 0=invalid)


RotaryEncoder rotary(7, 8, 5);  
// Connecting Rotary channels A en B to Digital pin 7 and 8.
// Digital pin 5 is for the switch
// Common to Ground, the RotaryEncoder does use internal pull-ups (read RotaryEncoder library)

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 10, 0, 110 };


void setup()
{
  BlinkM_begin();
//  BlinkM_beginWithPower();         // to make blinkm use the power of Arduino
  BlinkM_stopScript(blinkm_addr);  // turn off BlinkM script
   Serial.print("Blinkm default script is stopped\n");

rotary.minimum(0);
rotary.maximum(255);
rotary.position(100);

pinMode(relais_pin, OUTPUT);  // Defining the relais port to use as an output port
randomSeed(analogRead(0));    // getting a randomized number from an analog port so we are sure it's random.

  Serial.begin(9600);
  Serial.print("Brightness initialized to: ");
  Serial.print(my_brightness);
  Serial.print("\n");
  Serial.print("Hue initialized to: ");
  Serial.print(my_hue);
  Serial.print("\n");    

  Serial.print("Power is off\n");  
  Serial.print("Relais for power-leds is not active\n");  
  Serial.print("press the button to power up\n\n");
}







void loop()
{

if (my_power == false) {
  BlinkM_stopScript(blinkm_addr);             // turn off BlinkM script    
  BlinkM_setFadeSpeed(blinkm_addr, 5);        // Slow down fade speed, so the lights will dim before power is cut
  BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, 0);  // Start the fade out
  if (my_power_history == true) {delay(5000); my_power_history = false;}  // if the power before was true, the delay wil first dim the lights and next kill the power source
  digitalWrite(relais_pin, LOW);             // un-power a relais that triggers the power-led driver

}



if(rotary.pressed()) // If you press the (rotary) button, you are changing the menu.
// The following rules will apply only once after the button has been pushed until further notice
{
  if (my_power == false) {intro = true; goto intro_start;}
  Serial.print("\n\n     Rotary Pressed\n\n");
  if (my_menu == 5)      // I only defined 5 menu's, you can add more by increasing this my_menu number)
        my_menu = 0;     // if you are at the last menu, go back to the initial menu number
        else
increase_menu_number:
        my_menu ++;      // increase the menu number if it's not allready at max.
  Serial.print("Menu nr: ");
  Serial.print(my_menu);
  Serial.print("\n");  
  delay(300); // wait a bit so the button is not repeated many times


if (my_menu == 1)  {
  my_information = true; // Informing the user we are at menu 1
  rotary.position(my_brightness); // Giving the rotary the current brightness level back so we can controll it.
    Serial.print("Now controlling brightness");
  Serial.print("Current brightness level = ");
  Serial.print(rotary.position());
  Serial.print("\n\n");
 }


else if (my_menu == 2) {
    my_information = true; // Informing the user we are at menu 2
    rotary.position(my_hue); // Giving the rotary the current Hue level back so we can controll it.
    my_hue = rotary.position();                  // This gives the hue the new value
    Serial.print("Now controlling Hue");
    Serial.print("Current Hue Colour = ");  
    Serial.print(rotary.position());
    Serial.print("\n\n\n");  
}


else if (my_menu == 3) {
  my_information = true; // Informing the user we are at menu 3
  rotary.position(my_brightness);               // Giving the rotary the current brightness level back so we can controll it.
  Serial.print("Now going random colour \n");
  Serial.print("We can still controll brightness in random mode\n");
  Serial.print("Current brightness level = ");
  Serial.print(my_brightness);
  Serial.print("\n\n");


}
    

else if (my_menu == 4)
    {
 //   my_information = true; // Informing the user we are at menu 4
    Serial.print("Running default program from BlinkM\n");  
    BlinkM_setFadeSpeed(blinkm_addr, 250);                    // For HUE testing purposes I want to change colours fast.
    BlinkM_setTimeAdj(blinkm_addr, 0);                        // Set playspeed to normal
    BlinkM_playScript(blinkm_addr, my_blinkm_program, 0, 0);  // Play pre-programmed script from BlinkM looping forever
    Wire.send('p');
    }
  
  
   else if (my_menu == 5)
    {
    Serial.print("Killing lights, power is now off\n");  
    Serial.print("Relais for power-leds is de-activated\n");  
    Serial.print("press the button to power up\n\n");
    my_power = false;
 //   BlinkM_setFadeSpeed(blinkm_addr, 10);
 }

}
// Here the code ends that apply to the press of the button. The next rules will continue to loop.

I'm not a coder expert, so If you have suggestions/improvements, they are all welcome as I'm learning on my way.

Foto's and video's will follow :wink:
In 2 to 3 month's my house is rebuild with ~ 15 meter rgb strips.
At the moment it's all on boards.

And some photos :slight_smile:

The project sounds very cool

code PART 2:

intro_start:

if (my_information == true) {   // if true, blink lights to inform you what menu you are in
  BlinkM_setFadeSpeed(blinkm_addr, 20);   // Fadespeed to visible
  Serial.print("Now informing the user about menu nr: ");
  Serial.print(my_menu);
 Serial.print("\n");
  delay(250);
  for (int i=1; i <= my_menu; i++){
    BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, 0 );            // Light go out
  delay(250);                                          // wait a bit
  BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val );      // Back to the current value
  delay(250);
  if (i == my_menu) { my_information = false; } // resetting the information field when done
}
}
// When done informing, run the intro (if true) or selected menu with the next lines of code

else if (intro == true) {
my_power = true;                           // parameter to check later in code
my_power_history = true;                   // parameter needed to fade out in the end
digitalWrite(relais_pin, HIGH);            // power up the led driver
Serial.print("2 second delay to warm up the led drivers\n");
delay (2000);                              // Give the power led driver 2 sec. before firering the amps
BlinkM_setFadeSpeed(blinkm_addr, 1);
Serial.print("..intro start..\n");
bri_val = my_brightness;       // read the brightness variable
hue_val = my_hue;              // read the hue variable
BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val );
delay(8000);  // This intro can last as long for this delay
Serial.print("..intro  done..\n\n");
intro = false;
goto increase_menu_number;
//my_menu++;
}


else {
if (my_menu == 1 ) { 
if (my_power_history == false) { BlinkM_setFadeSpeed(blinkm_addr, 5); }
else {  BlinkM_setFadeSpeed(blinkm_addr, 150);      }  // fading speed between colours
   my_brightness = rotary.position();               // This gives the brightness the new value
bri_val = my_brightness;       // read the brightness variable
hue_val = my_hue;              // read the hue variable
BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val );
}

if (my_menu == 2) { 
   BlinkM_setFadeSpeed(blinkm_addr, 150);      // fading speed between colours
   my_hue = rotary.position();                  // This gives the hue the new value 
bri_val = my_brightness;       // read the brightness variable
hue_val = my_hue;              // read the hue variable
BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val );
}

if (my_menu == 3 ) { 
  BlinkM_setFadeSpeed(blinkm_addr, 1);         // Fadespeed to slowest setting possible
  my_brightness = rotary.position();                         // This gives the brightness the new value    
  when_to_randomize_counter++;
  if (when_to_randomize_counter == when_to_randomize) {
  my_hue_random = random(255);
  Serial.print("\nChanging to a random colour   Hue : ");
  Serial.print(my_hue_random);
  Serial.print("   Brightness : ");
  Serial.print(my_brightness);
  Serial.print("\n");
  when_to_randomize_counter = 0;
bri_val = my_brightness;       // read the brightness variable
hue_val = my_hue;              // read the hue variable
BlinkM_fadeToHSB( blinkm_addr, my_hue_random, 255, bri_val );
// BlinkM_fadeToRandomRGB(blinkm_addr, my_hue_random,my_hue_random, my_hue_random); // Only for testing purposes, because MaxM's don't show the correct HUE colour
}
}   




delay(100);  // wait a bit because we don't need to change the light that fast

}
 

}

A new day, a new code:

The code has completely been rewritten as I'm learning on the fly.
functional it does:

pressing once, powerup and enter menu1:
with every short press of the button it will switch between brightness, hue and saturation.
press and holding the button longer will change between menu's and you enter menu2:
also now with every short press you switch between the options in menu 2: fading between colours, default blinkm programs etc.

  • some notes:
    I've tested these with blinkm's (not maxm's) and the saturation looks strange.
    When I use Maxm's they don't respond very well to hue, but do respond ok to rgb code.
    I don't know why.
    And I need to get the webserver code up&running so I can controll it from windows mobile, laptop, and iphone.

VERSION 2.5 PART 1

/* --------------------------------------------------------------------
Welcome to La Bougie v 2.5  2009-06-26
A controller for RGB mood lightning using BlinkM
Connect a rotary controller with common gnd.
Using and controlling an ATX power supply to power arduino and blinkm's

digital 5 - rotary button
digital 7 - Rotary A 
digital 8 - Rotary B
digital 6 - will trigger the relais for powering the atx power supply (atx green to ground)
digital 9 - will blink a led to show the program is running

press button once will power up, and enter menu1.
press the button short will change the options within the menu's.
press the button longer will change between menu's.
menu  1        : Controlling Brightness, Hue and Saturation
menu  2        : randomize colours, and some blinkm presets
holding the button very long will power off
-------------------------------------------------------------------- */


#include "RotaryEncoder.h"
#include "Wire.h"
#include "BlinkM_funcs.h"

#include <WString.h>
#include <Client.h>
#include <Ethernet.h>
#include <Server.h>


#define blinkm_addr 0x00
int my_menu = 1;                            // The first menu to start with
int my_previous_menu = 0  ;                 // To see from which menu we came
int my_option = 1;                          // The first option to start with

int my_hue = 128;                      // Default hue        at startup, which will be changed by the rotary controller
int my_brightness = 255;                // Default brightness at startup, which will be changed by the rotary controller
int my_saturation = 255;                  // Default saturation at startup, which will be changed by the rotary controller

byte hue_val;                               // This is used to transmit via the l2c blinkm command and will receive the my_ value
byte bri_val;                               // This is used to transmit via the l2c blinkm command and will receive the my_ value
byte sat_val;                               // This is used to transmit via the l2c blinkm command and will receive the my_ value

int my_poweroff_timer = 4000;               // timer holding the button to power off
int my_option_timer   =  600;               // timer holding the button to change between options within menu's
int my_menu_timer     = 3000;               // timer holding the button to change between menu's

int my_hue_random= 100;                     // just to initialize, it will get random in the code
int my_saturation_random = 100;

boolean my_power = false;                   // false will eventually disable an external driver for power-leds

int my_driver_warmup = 4000;                // Delay in msec to warm up the driver for the leds
int my_driver_cooldown = 4000;              // Delay in msec to cool down the driver for the leds (leaving the fan spinning for some time)
int relais_pin = 6;                      // a reserved port for a relais that triggers the driver for the power-leds
int running_led_port = 9;                // a reserved port for blinking the running_led
boolean running_led_state = false;
int running_led_interval = 50;                  // a reserved counter to blink the running_led
long running_led_Millis = 0;
int when_to_randomize_counter = 0;          // counter needed to calculate when to random
int when_to_randomize = 100;                // increase to enlange cycles between randomize in menu 2, option 1. value 100 = ~ 10 seconds
long  keypress_time = 0;                    // Using this to count differences between millis() = function that counts the number of milliseconds since the program started running

int menu[] = {1, 3, 5};                     // The nr of options belong to a menu nr. Notice, the first is menu 0 (which we don't use).



RotaryEncoder rotary(7, 8, 5);  
// Connecting Rotary channels A en B to Digital pin 7 and 8.
// Digital pin 5 is for the switch
// Common to Ground, the RotaryEncoder does use internal pull-ups (read RotaryEncoder library)


// USED FOR WEBSITE [start]
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 10, 0, 110 };
Server server(80);
#define maxLength 25
String inString = String(maxLength);
int val;
int HSB_GET;
// USED FOR WEBSITE [end]

void setup()                        // void setup is only executed once when the system boots up
{
  Serial.begin(9600);               // initializing serial over usb speed 
  Serial.print("Hello World\n");    // Giving a message to the world we are operating
rotary.minimum(0);                  // the minimum value the rotary can give
rotary.maximum(255);                // The maximum value the rotary can give
rotary.position(100);               // this is just an initializing value, it will addapt to every menu (hue, brightness, saturation etc)
    hue_val = my_hue;                                       // initialize the sending value
    sat_val = my_saturation;                                // initialize the sending value
    bri_val = my_brightness;                               // initialize the sending value
pinMode(relais_pin, OUTPUT);                     // Defining the relais port to use as an output port
pinMode(running_led_port, OUTPUT);               // Defining the port to use as an output port
randomSeed(analogRead(0));                       // getting a randomized number from an analog port so we are sure it's random.
Serial.print("\nPower is off, relais for psu is not active\n");  
Serial.print("press the button to power up\n\n");
Ethernet.begin(mac, ip);                         // This line initializes the ethernet board, it should now be pingable now.
server.begin();
}




void loop()
{
rotary_button_pressed();
actions2do();
blinkyblink();
}

see part 2 for the other code as this message exceeds 9500 characters.

VERSION 2.5 PART 2

// Programming code of the functions we use, are below:

// ROTARY BUTTON PRESSED - START
int rotary_button_pressed() {
start_from_powerdown:
  if(rotary.pressed()) {
  Serial.print("\n\n     Rotary Pressed.\n");
  if (my_power == false) { intro(); goto letsbegin;}

keypress_time = millis();     // resetting the keypress_time to current program running time
holding_button:
if ( (millis() - keypress_time) >= my_poweroff_timer ) {  powerdown() ; }
delay(50); // wait a bit so the button is not repeated extremely fast
if (my_power == false) { goto start_from_powerdown; }
if(rotary.pressed()) { goto holding_button; }

    Serial.print("     Current program running time = ");
    Serial.print(millis());
    Serial.print(" msec\n");
      Serial.print("     Time that you pressed the button down = ");
      Serial.print(millis() - keypress_time);
      Serial.print(" msec\n");
// Counting the time the button is being held - STOP

if ( (millis() - keypress_time) <= my_option_timer ) {
   option_switch() ; }                                    // switching between options within the menu if you press between the defined time

if ( (millis() - keypress_time) >= my_option_timer 
  && (millis() - keypress_time) <= my_menu_timer ) {
   menu_switch() ; }                                     // switching between menu's if you press between the defined time

letsbegin:                                      // The intro will send you here at the first time.
if (my_menu == 1)  {
if (my_previous_menu != my_menu) {              // if the previous menu wasn't this menu, reset the option back to 1
    my_option = 1 ;                             // if the previous menu wasn't this menu, reset the option back to 1
    Serial.print("Menu 1\n");
    BlinkM_setFadeSpeed(blinkm_addr, 25);      // fading speed between colours
    my_information(my_menu) ;                   // Informing the user we are at menu 1
    }

if (my_option == 1) { 
    Serial.print("Now controlling brightness\n"); 
    rotary.position(my_brightness); // Giving the rotary the current brightness level back so we can controll it.
    status_update();
    }

if (my_option == 2) { 
    Serial.print("Now controlling hue\n"); 
    rotary.position(my_hue); // Giving the rotary the current Hue level back so we can controll it.
    status_update();
    }
if (my_option == 3) { 
    Serial.print("Now controlling Saturation\n"); 
    rotary.position(my_saturation); // Giving the rotary the current Saturation level back so we can controll it.
    status_update();
    }
    
my_previous_menu = my_menu; // Giving the parameter the new menu nr.
 }


else if (my_menu == 2) {
if (my_previous_menu != my_menu) {
  my_option = 1 ;
  Serial.print("Menu 2\n");
my_information(my_menu); // Informing the user we are at menu 2
  }
if (my_option == 1) { 
    Serial.print("Now going random with brightness controll\n"); 
    rotary.position(my_brightness);               // Giving the rotary the current brightness level back so we can controll it.  
    status_update();
    }

if (my_option == 2) { 
    Serial.print("Now running a default blinkm script\n"); 
    BlinkM_setFadeSpeed(blinkm_addr, 250);                    // For HUE testing purposes I want to change colours fast.
    BlinkM_setTimeAdj(blinkm_addr, 0);                          // Set playspeed to normal
    BlinkM_playScript(blinkm_addr, 12, 0, 0);      // Play pre-programmed script from BlinkM looping forever
    Wire.send('p');                                               // What's this? maybe to synchronize the play?
    status_update();
    }

if (my_option == 3) { 
    Serial.print("Now running a default blinkm script\n"); 
    BlinkM_setFadeSpeed(blinkm_addr, 250);                    // For HUE testing purposes I want to change colours fast.
    BlinkM_setTimeAdj(blinkm_addr, 0);                          // Set playspeed to normal
    BlinkM_playScript(blinkm_addr, 13, 0, 0);      // Play pre-programmed script from BlinkM looping forever
    Wire.send('p');                                               // What's this? maybe to synchronize the play?
    status_update();
    }
    
if (my_option == 4) { 
    Serial.print("Now running a default blinkm script\n"); 
    BlinkM_setFadeSpeed(blinkm_addr, 250);                    // For HUE testing purposes I want to change colours fast.
    BlinkM_setTimeAdj(blinkm_addr, 0);                          // Set playspeed to normal
    BlinkM_playScript(blinkm_addr, 14, 0, 0);      // Play pre-programmed script from BlinkM looping forever
    Wire.send('p');                                               // What's this? maybe to synchronize the play?
    status_update();
    }
    
if (my_option == 5) { 
    Serial.print("Now running a default blinkm script\n"); 
    BlinkM_setFadeSpeed(blinkm_addr, 250);                    // For HUE testing purposes I want to change colours fast.
    BlinkM_setTimeAdj(blinkm_addr, 0);                          // Set playspeed to normal
    BlinkM_playScript(blinkm_addr, 10, 0, 0);      // Play pre-programmed script from BlinkM looping forever
    Wire.send('p');                                               // What's this? maybe to synchronize the play?
    status_update();
    }


my_previous_menu = my_menu;
  }
 }
}
// ROTARY BUTTON PRESSED - STOP


// ACTIONS TO DO WHEN POWER IS ON - START
int actions2do() {
  if (my_power != false) {
 
if (my_menu == 1 ) {
    if (my_option == 1) {  
    my_brightness = rotary.position();                     // The Rotary gives brightness the new value
    hue_val = my_hue;                                       // send the (changed) value to the transmitted value
    sat_val = my_saturation;                                // send the (changed) value to the transmitted value
    bri_val = my_brightness;                               // send the (changed) value to the transmitted value

    BlinkM_fadeToHSB( blinkm_addr, hue_val, sat_val, bri_val );
    }
    if (my_option == 2) {
    my_hue = rotary.position();                           // The Rotary gives hue the new value 
    hue_val = my_hue;                                       // send the (changed) value to the transmitted value
    sat_val = my_saturation;                                // send the (changed) value to the transmitted value
    bri_val = my_brightness;                               // send the (changed) value to the transmitted value
    BlinkM_fadeToHSB( blinkm_addr, hue_val, sat_val, bri_val );
    }
    if (my_option == 3) {
    my_saturation = rotary.position();                  // The Rotary gives saturation the new value 
    hue_val = my_hue;                                       // send the (changed) value to the transmitted value
    sat_val = my_saturation;                                // send the (changed) value to the transmitted value
    bri_val = my_brightness;                               // send the (changed) value to the transmitted value
    BlinkM_fadeToHSB( blinkm_addr, hue_val, sat_val, bri_val );
    }
}


if (my_menu == 2 ) {

   if (my_option == 1) {  
    BlinkM_setFadeSpeed(blinkm_addr, 1);         // Fadespeed to slowest setting possible
    my_brightness = rotary.position();                         // This gives the brightness the new value    
    when_to_randomize_counter++;
    if (when_to_randomize_counter == when_to_randomize) {
    my_hue_random = random(255);
    my_saturation_random = random (255);
    when_to_randomize_counter = 0;
    bri_val = my_brightness;                // read the new brightness variable for transmitting to blinkm
    hue_val = my_hue_random;              // read the new hue variable for transmitting to blinkm
    sat_val = my_saturation_random;       // read the new saturation variable for transmitting to blinkm
    status_update();
    BlinkM_fadeToHSB( blinkm_addr, my_hue_random, my_saturation_random, bri_val );
    // BlinkM_fadeToRandomRGB(blinkm_addr, my_hue_random,my_hue_random, my_hue_random); // Only for testing purposes, because MaxM's don't show the correct HUE colour
     }
    }

 }
} 
}
// ACTIONS TO DO WHEN POWER IS ON - STOP

// CHANGE OPTION - START
int option_switch() {
  BlinkM_stopScript(blinkm_addr);       // Stop playing a predifined blinkm program if a previous menu/option had this running
  if (my_option == menu[my_menu] )      // comment this
        my_option = 1;     // if you are at the last menu, go back to the initial menu number
        else
increase_option_number:
        my_option ++;      // increase the menu number if it's not allready at max.
  Serial.print("Changing to option nr: ");
  Serial.print(my_option);
  Serial.print("\n");  
}
// CHANGE OPTION - STOP


// CHANGE MENU - START
int menu_switch(){
  BlinkM_stopScript(blinkm_addr);       // Stop playing a predifined blinkm program if a previous menu/option had this running
  if (my_menu == 2)      // I only defined 2 menu's, you can add more by increasing this my_menu number)
        my_menu = 1;     // if you are at the last menu, go back to the initial menu number
        else
        my_menu ++;      // increase the menu number if it's not allready at max.
  Serial.print("Changing to menu nr: ");
  Serial.print(my_menu);
  Serial.print("\n");  
}
// CHANGE MENU - STOP

VERSION 2.5 PART 3 (LAST)

// INFORMATIONAL BLINK - START
int my_information(int InformationBlink) {
  BlinkM_setFadeSpeed(blinkm_addr, 20);   // Fadespeed to visible
  Serial.print("Now blinking ");
  Serial.print(my_menu);
 Serial.print(" time(s), to inform the user in which menu we are.\n");
  delay(250);
  for (int i=1; i <= my_menu; i++){
    BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, 0 );            // Light go out
  delay(250);                                          // wait a bit
  BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val );      // Back to the current value
  delay(250);
}
}
// INFORMATIONAL BLINK - STOP


// INTRO - START
int intro() {
my_power = true;                           // parameter to check later in code
digitalWrite(relais_pin, HIGH);            // power up the led driver
Serial.print("Power up with aelay to warm up the psu capacitors\n");
delay (my_driver_warmup);                              // Give the power led driver 2 sec. before firering the amps
Serial.print("..intro start..\n");
bri_val = my_brightness;                 // read the last brightness variable
hue_val = my_hue;                       // read the last hue variable
  BlinkM_begin();                          // Start the L2C bus protocol on arduino's analog pin 4 (data) and 5 (clock)
  BlinkM_stopScript(blinkm_addr);          // turn off BlinkM script
  BlinkM_setFadeSpeed(blinkm_addr, 1);                     // Fade nicely in at startup, 
  BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val );  // or do some other fancy rgb test over here.
delay(5000);                               // Give the intro some time to fade in, before the menu starts.
Serial.print("..intro  done..\n\n");

}
// INTRO - STOP

// POWERDOWN - START
int powerdown() {
  Serial.print("Power down\n");
  my_power = false;                           // Have to say again that power is false, if it did not get here via a menu choice
  my_menu = 1 ;                                // Reset the menu to 1, so when pressing again, the menu is back at the beginning again.
  my_option = 1;
  BlinkM_setFadeSpeed(blinkm_addr, 5);        // Slow down fade speed, so the lights will dim before power is cut
  BlinkM_stopScript(blinkm_addr);             // turn off BlinkM script    
  BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, 0);  // Start the fade out to black
  Wire.endTransmission();                    // stop the L2C bus on arduino, so we can kill the power to the LED's, otherwise arduino freezes.
  delay(my_driver_cooldown);                 //  give the psu some cool down time so the psu fan can cool the psu before we kill the power.
  digitalWrite(relais_pin, LOW);             // un-power a relais that triggers the power-led driver
  Serial.print("\nPower is off, relais for psu is not active\n");  
  Serial.print("press the button to power up\n\n");
  }
// POWERDOWN - STOP

// STATUS UPDATE - START
int status_update() {
  Serial.print("Status:");
  Serial.print("  brightness = ");
  Serial.print(bri_val, DEC);
  Serial.print("  Hue = ");  
  Serial.print(hue_val, DEC);
  Serial.print("  Saturation = ");  
  Serial.print(sat_val, DEC);
  Serial.print("\n");
}
// STATUS UPDATE - STOP

// PROGRAM RUNNING BLINK - START
int blinkyblink() {
  delay(100);  // wait a bit because we don't need to run the whole program so fast

   if (millis() - running_led_Millis > running_led_interval) {
    // save the last time you blinked the LED 
    running_led_Millis = millis();   

    // if the LED is off turn it on and vice-versa:
    if (running_led_state == LOW)
      running_led_state = HIGH;
    else
      running_led_state = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(running_led_port, running_led_state);
   }
} 
// PROGRAM RUNNING BLINK - STOP

Hi,

First of all, great name!! second, very good project
I just found your video, and this post, and it looks good..
and now i'm trying to make it for myself..
I got an homemade encoder, from a hd, and a blinkM..
Looking trough the La bougie code i saw a lot of library's that the program can't find..

Which RotaryEncoder library are you using, or do you have more information.., or a complete file ?

Now i'm trying the code, but it keeps hanging in the warm-up fase...

thanks for the good work,

Hi Mies,
Thank you for your comments.
It's allways nice to read that I'm not the only one that crazy :smiley:

I've got the "Bougie" now running in my home, but I need to do a few outstanding jobs in my home before I can finish the whole setup.
I've changed the code a bit and need to upload the current one.

let's keep in touch in this forum.
Enjoy your Hollidays!