Problems writing scripts
When storing a script into a BlinkM, I find that to reliably store the script, I need an explicit delay of about a 20-millisec between 'W' commands. This is with both a Basic Stamp 2p and an Arduino. With the BS2p the BlinkM is powered by 5v, not from the BS2p module, in a solderless breadboard. With the Arduino, I've got the BlinkM connected directly on the Arduino USB board and using the (modified) BlinkM_writeScript() function. Especially with the Arduino, I can't imagine that I'm doing anything wrong. And yes, I am stopping the current script prior to writing a new one.
Any ideas?
Any ideas?
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?Hi,
Yup, that's a "feature" of writing to EEPROM or flash on microcontrollers. The per-byte write time is about 4.0ms (as per the AVR ATtiny45 datasheet) and there are 5 bytes in a script line (duration, command, arg1,arg2,arg3). So the total time is about 20ms. Any command that changes a persistent value in the BlinkM (address, startup params, etc.) will also need a delay.
Apologies for not calling that out in the datasheet. I'll put in the approximate write times for the various commands so others won't get confused by this. -
Inappropriate?Thanks Tod!
That doesn't surprise me at all although I s'pose I was of the thinking that the
code in the Tiny45 would have "dealt with that". Then again, not doing that
allows the host device to go off and do something else whilest the '45's
memory is settling down.
Please keep in mind that the BlinkM_writeScript() will need a mod since it's
just looping around BlinkM_writeScriptLine() with no delays. Users of the
API can not prevent this issue without modifying that function.
Thanks again for the quick response!
-Rusty-
I’m pretty pleased
-
Inappropriate?Hi Rusty,
Yeah, if the BlinkM had enough RAM, I would rather have a command that lets you send an entire script and it would deal with the looping and writing. Then it could be optimally fast.
Thanks for the suggestion about writeScriptLine(). It's not a well-tested function. I'll add a delay() and then continue to not test it (for now :-)
If you're into doing light scripts, try out the new BlinkMScriptTool Processing sketch. It's a simple text GUI that lets you upload & download light scripts and load/save them to disk. It's located in the BlinkM_Examples.zip bundle and expects the BlinkMCommunicator Arduino sketch to be on the Arduino interconnecting the computer & BlinkM.
The company says
this answers the question
-
Inappropriate?Hi Tod,
Well, continue to NOT test it then! :-P
Be that way! Oh, you are. (sigh)
Daggummit! That ScriptTool is just what I've been wanting.
Thank you, sir! I do appreciate it. :-)
I’m just pickled tink!
Loading Profile...



EMPLOYEE