Recent activity
Subscribe to this feed
Alek replied on September 20, 2009 00:17 to the question "Rotarty switch to change scripts" in ThingM:
Alek asked a question in ThingM on September 19, 2009 08:33:
Rotarty switch to change scriptsHey again all!
So i got the whol scripting thing going thanks to your help.
All BlinkM's are powered from an external 5v adapter
But for my purposes what if like to do is store say 13 scripts in 1 sketch and upload it to ardunio. Then connect all 13 digital points to a rotary dial , and from that to a single push button switch.
So you rotate the dial to the script you want thats already on Ardunio, then hit the push button and it sends it down the i2c chain to all 8 BlinkM's
Has anyone done this before!?
I've tried using the base arduino code from here http://arduino.cc/en/Tutorial/Button and modifying the code, but it didnt work to well.... it just seemed to make it go red.
Here is the best part of my code
void setup()
{
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
BlinkM_beginWithPower();
BlinkM_stopScript(all_call); // turn off startup script
BlinkM_setRGB( all_call, 0x00,0x00,0x00);
}
void loop()
{
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
BlinkM_setRGB( all_call, 0x00,0xff,0x00);
delay(500);
BlinkM_setRGB( all_call, 0x00,0x00,0xff);
delay(500);
} else {
BlinkM_setRGB( all_call, 0xff,0x00,0x00);
}
}
Thanks in advance all!
Alek asked a question in ThingM on September 08, 2009 09:51:
Scripting for dummiesHi all
I love these BlinkM's, bought 1 about a year ago and the other 3 arrived today (no they werent the same order :P)
Anyway
I powered em up, gave em unique addresses, but I'm having some issues writing light scripts. This is something so basic that im probably just missing a step, but some input would be great.
Using the BlinkM examples, i can get each BlinkM talking with each other, i can make them all play a script, stop it on 1 BlinkM etc etc
So i thought, ill try and write my own basic light script and move up from there. But i keep hitting a wall.....
Firstly, is there a page somewhere BlinkM scripting for dummies, ive searched the net and cant find any examples on how to write BlinkM scripts.
So i open a plan Ardunio sketch, and copy the code straight from the datasheet for BlinkM into it
#include “Wire.h”
Wire.begin(); // set up I2C
Wire.beginTransmission(0x09);// join I2C bus, to BlinkM 0x09
Wire.send(‘f’); // ‘f’ == fade to color
Wire.send(0xff); // value for red channel
Wire.send(0x00); // value for blue chan.
Wire.send(0x00); // value for green chan.
Wire.endTransmission(); // leave I2C bus
and i hit upload to board, and it hits an error
error: expected constructor, destructor, or type conversion before '.' token
and highlights this line Wire.begin(); // set up I2C
i tried Begin blinkM with power to no avail.
In this test scenario it is just a single BlinkM plugged straight into the last 4 pins of arduino.
So i guess what im asking is, how do you write a light script and upload it.......
And what does that error mean, because everything i try i keep getting that exact same error
Thanks all
Loading Profile...
