Basic Stamp2 and Blink M
Oper8r Al
Posts: 98
On a whim I purchased a BlinkM led module when I was ordering some other stuff. I have been trying to get it to interface to a bs2. Between the Sample code that was on the BlinkM site and reading i2c nuts and volts columns. I have been able to send data commands to it. My code probably isn't the best way and I know it needs improvement but sending data is working now. The problem I have is I can't seem to receive data back from module. I was trying to get the firmware version just as a test to read from the BlinkM and all I get back is (255). I am sure it is something in my code and was hoping someone could take a look at it and point me in the right direction. . I will attach the code and a link for data sheet for the BlinkM. Any help appreciated.
Thanks,
Al
Here is the link for the Data Sheet:thingm.com/fileadmin/thingm/downloads/BlinkM_datasheet.pdf
Edit: fixed link to datasheet
Thanks,
Al
Here is the link for the Data Sheet:thingm.com/fileadmin/thingm/downloads/BlinkM_datasheet.pdf
Edit: fixed link to datasheet
Comments
·· I had a similar experience and finally gave up. I wanted to read the preloaded scripts but never could get it working. It was frustrating!
Good luck!
-Phil
Numbers are interchangeably represented as decimal or hexadecimal, and in some cases,
ASCII characters. Hexadecimal numbers are represented with either a 0x prefix (to indicate use in code, like {0xff,0x00,0x9a}) or # prefix (to indicate a color, like #FF00FF);
Go to RGB Color Now n 0x6e 3 0 {n,R,G,B}
Fade to RGB Color c 0x63 3 0 {c,R,G,B
}
Fade to HSB Color h 0x68 3 0 {h,H,S,B}
Fade to Random RGB Color C 0x43 3 0 {C,R,G,B}
Fade to Random HSB Color H 0x48 3 0 {H,H,S,B}
Play Light Script p 0x70 3 0 {p,n,r,p}
Stop Script o 0x6f 0 0 {o}
Set Fade Speed f 0x66 1 0 {f,f}
Set Time Adjust t 0x74 1 0 {t,t}
Get Current RGB Color g 0x67 0 3 {g
}
Write Script Line W 0x57 7 0 {W,n,p,...}
Read Script Line R 0x52 2 5 {R,n,p}
Set Script Length & Repeats L 0x4c 3 0 {L,n,l,r}
Set BlinkM Address A 0x41 4 0 {A,a...}
Get BlinkM Address a 0x61 0 1 {a}
Get BlinkM Firmware Version Z 0x5a 0 1 {Z}
Set Startup Parameters B 0x42 5 0 {B,m,n,r,f,t}
New MaxM/MinM commands MaxM / MinM*
Knob Read RGB k 0x6b 3 0 {k,R,G,B}
Knob Read HSB K 0x4b 3 0 {K,H,S,B}
Jump, relative j 0x6a 1 0 {j,j}
Input Read & Jump i 0x69 3 1 {i,i,v,j}
Input Jump Immediate I 0x49 3 0 {I,i,v,J}
blinkm
I'm using a plain BS2, so must use bit-banging for the i2c communication.
The strange thing is that sending data is no problem, BlinkM reacts succesfully to all kind of commands, so far so good. This means that the (simple) start- , stop and send i2c procedures must be correct.
For example these commands work fine:
- Go to RGB Color Now n 0x6e 3 0 {n,R,G,B}
- Play Light Script p 0x70 3 0 {p,n,r,p}
- Stop Script o 0x6f 0 0 {o}
But I still have not succeeded in reading data from the device.
For example these commands:
- Get Current RGB Color g 0x67 0 3 {g}
- Get BlinkM Address a 0x61 0 1 {a}
- Get BlinkM Firmware Version Z 0x5a 0 1 {Z}
I have attached the bs2-file, I have used a source file of Jon Williams.
The read procedure is called: BlinkMCmd_read
Summary:
1. start procedure
2. put write address i2c bus (BlinkM address = 9, shift left, address is upper 7 bits makes write address 18)
3. send command 'g' (get current RGB color from BlinkM)
4. repeated start procedure
5. put read address on i2c bus (read address is 19)
6. read 1st byte (Red) with ack
7. read 2nd byte (Green) with ack
8. read 3rd byte (Blue) with Nack
9. stop procedure
Maybe the above mentioned sequence is wrong somewhere?
Both Nuts & Volts 85 and 115 I have been studying, but I cannot seem to find the problem.
On this forum more people have had this same problem, unfortunately unresolved so far...
Has ayone tried this -or something similar- and succeeded?
*SHAME* ... pull up resistors wrong mounted ... *SHAME*
Only looking at the source code instead of thoroughly checking the hardware...