Help get this topic noticed by sharing it on Twitter, Facebook, or email.

How do I attach a button to a blinkM that cycles scripts?

how can I attach a button to a blinkM that cycles through the pre-defined light scripts?
2 people have
this question
+1
Reply
  • Perhaps the easiest way to try out the different built-in light scripts is to load up the "BlinkMTester" Arduino sketch available in the BlinkM_Examples.zip bundle and type the "p" command from the Arduino Serial Monitor to play the different scripts.

    For example, "p0" will play the reprogrammable light script (default as white->red->green->blue->off, repeat), and "p7" will play a slowly fading magenta flash. You can adjust the speed of the fading by typing the "f" command (e.g. "f100" will make the fading very fast, and "f5" will make it slow). And you can adjust the speed at which the script is played by type the "t" to set the timeadjust value (e..g. "t-10" will cause things to play faster, "t20" to make them play slower) And if you want to stop scripts playing, type "o" to send the Stop command.

    At the moment, only BlinkM MaxMs, not regular BlinkMs, can take a button input directly. (There will eventually be an update to regular BlinkMs to allow dual use of BlinkM's I2C as button inputs. If you have access to an AVR-ISP programmer, don't mind doing some breadboarding, and want to try out some beta firmware, contact us at blinkm at thingm.com)
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Thank you~ I should have specified, I am working with a MaxM. I'm new to this and have a project that I'd like to be able to cycle thru scripts with a button. If you could tell me how that could be accomplished, I'd really apprecitate it. I'm also interested in attaching a sensor directly to the MaxM (such as an accelerometer) to display different images based on speed and location.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Hi,
    I'm using this code to cycle scripts. For circuit layout check arduino spooky projects class notes 2. I'm using an Arduino to control blinkms.

    const int blinkm_addr = 0;
    int botonUnoPin = 7;
    int modoLeds = 0; // Selects LED Mode
    int modificarModo =0; // Aux variable to read button input
    int delay_time = 20 ; // Delay por defecto para encender y apagar las luces.

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

    void setup() {
    pinMode(ledPin, OUTPUT);
    pinMode(botonUnoPin, INPUT);
    BlinkM_beginWithPower();
    BlinkM_stopScript(blinkm_addr); // turn off starup script
    BlinkM_fadeToRGB(0,0,0,0); // turn off all leds
    }

    void loop() {
    digitalWrite(ledPin,LOW); //indicate we're waiting
    modificarModo = digitalRead(botonUnoPin); //read button
    if (modificarModo == LOW) { // If button is pressed
    modoLeds++; // Change mode
    BlinkM_stopScript(blinkm_addr);
    BlinkM_fadeToRGB(0,0,0,0); BlinkM_playScript(blinkm_addr,modoLeds,0,0);
    delay(100);
    }

    }

    I hope it helps and works! (I've deleted lots of debug info)
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • I’m happy
    1
    Hi,
    I'm using this code to cycle scripts. For circuit layout check arduino spooky projects class notes 2. I'm using an Arduino to control blinkms.

    const int blinkm_addr = 0;
    int botonUnoPin = 7;
    int modoLeds = 0; // Selects LED Mode
    int modificarModo =0; // Aux variable to read button input
    int delay_time = 20 ; // Delay por defecto para encender y apagar las luces.

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

    void setup() {
    pinMode(ledPin, OUTPUT);
    pinMode(botonUnoPin, INPUT);
    BlinkM_beginWithPower();
    BlinkM_stopScript(blinkm_addr); // turn off starup script
    BlinkM_fadeToRGB(0,0,0,0); // turn off all leds
    }

    void loop() {
    digitalWrite(ledPin,LOW); //indicate we're waiting
    modificarModo = digitalRead(botonUnoPin); //read button
    if (modificarModo == LOW) { // If button is pressed
    modoLeds++; // Change mode
    BlinkM_stopScript(blinkm_addr);
    BlinkM_fadeToRGB(0,0,0,0); BlinkM_playScript(blinkm_addr,modoLeds,0,0);
    delay(100);
    }

    }

    I hope it helps and works! (I've deleted lots of debug info)
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Thanks for the script Cesar. I ultimately want to control some LED strips hooked up to a MaxM. I want to switch between multiple scripts using a 6-position rotary switch. Your script should be a good starting point.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited