Controlling the BlinkM with RAD, has this been done properly?
All the examples in RAD related to the BlinkM are commented out, and I don't have the best understanding of I2C. I just want to be able to send commands to the BlinkM with RAD.
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?Sorry, what is RAD?
-
Inappropriate?oh geez, I didn't even realize that you may not have heard of RAD, http://rad.rubyforge.org/ It basically just does Ruby to C conversion, and loads the program on the Arduino, it has several libraries built in, so you don't have to include them including Wire. Also, someone has converted some of your BlinkM examples to Ruby!
See these:
http://github.com/madrona/rad/blob/ma...
http://github.com/madrona/rad/blob/ma... -
Also Ben Bleything has done excellent things with RAD, but nothing with I2C that is obvious. I realize you are probably not that into Ruby... but maybe If the library is included I can just run the method I need for the BlinkM to work! [wishful thinking?]
Here is Ben's talk at Rubyconf from 100 years ago it seems:
http://rubyconf2007.confreaks.com/d1t... -
Inappropriate?Ahh, okay, I seem to recall reading about RAD a while back. Pretty cool stuff.
Have you asked the author ("madrona"?) of those files why they were commented out?
If RAD is basically a substitution system for Ruby to C/C++, I can't imagine why it wouldn't work. That is, from what I can tell, it's not re-implementing all the Arduino libraries in Ruby that get converted to C++, but rather doing a kind of macro substitution. If it's doing more than that, I'd say stay away from it because there's then no way to use the huge number of useful libraries available for Arduino and it would always lag in bug fixes/updates in the core. (I couldn't find where RAD implemented all the Arduino core libraries which is why I assume it's doing a kind of macro substitution, not reimplementation) -
Inappropriate?Also, I don't fully grok github, but it looks like madrona's stuff is a downstream fork of atduskgreg's RAD. And his repo has blinkm stuff in it too:
http://github.com/atduskgreg/rad/blob... -
Inappropriate?So, I suppose I've figured out a lot, and thanks for the help so far! I guess I just have a simple question, and its not totally related to my original question.
If I'm running the BlinkM_communicator on the Arduino, what would a simple serial string look like that I could send it? umm... let me see if I can rephrase that; If I open my serial terminal while the arduino is running the BlinkM_communicator program, can't I just send {'H', 0xff,0x00,0x00} in the serial field and hit "send"? shouldn’t it run the command on the BlinkM? I must be doing something wrong.
I’m confused
-
Inappropriate?So I did a little more debugging, and I think I can give you a few more details. When I open the serial monitor when the program is running(with DEBUG) on the arduino I get:
BlinkMCommander ready
DEBUG MODE
But upon sending it something the monitor stays blank and the BlinkM doesn’t do anything :(
I've tried sending it some of the sample strings you had at the top of the sketch like:
{0x01,0x09,0x04,0x00, 'f',0xff,0xcc,0x33}
And still nothing, but when I open the Java App you guys made, BlinkMSequencer, I can play with that and everything works just perfect.
Am I sending serial incorrectly or something?
I’m confused
-
Inappropriate?Hey Tod, (I know I am slamming you with all this craziness) but I loaded the BlinkMTester sketch on the arduino and everything works lovely. I suppose I'm just sending serial incorrectly, for example in your BlinkMTester sketch you can change the color of the blinkM to any color just by doing "cff0000" or something, and that works great!
I guess the issue is that I want to address multiple BlinkM's and therefore I'll need to use the BlinkM_communicator sketch because I can address many blinkM's via I2C.
How can I get BlinkM_communicator to work in a similar fashion?
I’m confused
-
Inappropriate?Hi Joseph,
BlinkMCommunicator expects raw bytes to be sent, not ASCII. A BlinkMCommunicator command in the form:
{0x01,0x09,0x04,0x00, 'f',0xff,0xcc,0x33}
is almost exactly the syntax used in C/C++/Java/Processing for how to construct a byte array to send to BlinkMCommuncator.
For instance, in Processing (Java), a completely constructed command and sending it to BlinkMCommunicator via the Serial port object looks like this:
byte[] cmd = { 0x01,0x09,0x04,0x00, 'f',(byte)0xff,(byte)0xcc,(byte)0x33 };
serialPort.write( cmd );
(The "(byte)" is needed to force those values to look like bytes instead of ints because Java has signed bytes) -
Inappropriate?So I've gotten Ruby to properly write Byte Arrays to the serial device, however I still don't get any response at all from the Arduino, in the format you mentioned see here: http://stackoverflow.com/questions/15...
But in my serial console I still have the same output as before, no matter what commands I send to the device, I still get no response. After it compiles my serial console `screen` in this case, still shows:
BlinkMCommander ready
or
BlinkMCommander ready
DEBUG
If I'm in debug mode, otherwise I've been entirely unsuccessful at getting any communication with BlinkMCommunicator to work.
Any Idea of how to proceed? (also thanks for helping me get this far, you've been extraordinarily helpful!)
I’m sad
-
Inappropriate?You won't get any response over the serial port, as that command doesn't have any return values. But you should see the BlinkM change to that #FFCC33 color. If the BlinkM is playing its startup script, then you'll need to send the Stop Script command ('o') first. The BlinkMCommunicator byte array for that command would be:
{0x01,0x09,0x01,0x00, 'o'}
assuming your BlinkM is at address 9
1 person says
this answers the question
-
Inappropriate?Ok, so I was able to get it to return something with DEBUG on:
Which is pretty good, but It won't fade the BlinkM's I have it addressing the proper one also, What should the "sendlen" be?
startbyte
header
cmdlen:4
got all
addr:1 sendlen:4 recvlen:0 cmd[0..7]:66,FF,0,1,0,0,0,0
I’m indifferent
-
Inappropriate?Geez, don't laugh... funny thing about what I did, if you set the fade speed to 0... they don't really change...
Sorry for giving you the run-around, you did teach me a lot though!
I’m confident
-
Inappropriate?oh, so you got it working?
(and no problem, this is one of the harder concepts in BlinkM and you're doing it with a language not normally used to communicate with embedded devices)
Loading Profile...



EMPLOYEE