Hi,
I am looking to add features to the firmware and noticed that you are receiving 5 bytes before processing a command.
0 = dummy
1 = command
2 = pin
3 = other data
4 = other data
More details here:
The current firmware:
https://github.com/DexterInd/GrovePi/blob/master/Firmware/Source/v1.1/grove_pi_v1_1/grove_pi_v1_1.ino
I am looking at adding support for the Chainable RGB Led.
I found an Arduino library that works, however, I need more than 2 bytes to issue a command.
I had to change the constructor, to use a begin() method, like Karan did here:
0 = dummy
1 = command
2 = pin (dio, clock will always be dio + 1)
3 = number of leds in the chain
4 = which led do you want to light up
5 = red
6 = green
7 = blue
I was looking into ways I could squish the values into only two bytes, but it would mean drastically limiting the number of available colours. There has to be a better way…
Looking at your firmware, was there a reason you chose 5 bytes in your .receiveData() method? Is there a limit to how many bytes can be sent in a block?
In .receiveData() it looks like every 5 bytes you reset the index and start adding to the next command, and once it reaches 5 bytes, the main loop() runs the command.
Would it be possible to instead of counting n bytes before executing a command, provide a block length byte, for sensors such as this with a larger than normal number of bytes?
eg. the block would look something like this
0 = dummy
1 = block length
2 = command
3 = pin
4 = other data
5 = other data
…
13 = other data
14 = other data etc
Another possibility could be a end of block command, which keeps adding to the cmd[] array until the end is detected.
0 = dummy
1 = command
2 = pin
3 = other data
…
14 = other data
15 = end
Does anyone have any feedback / suggestions?
I am going to start experimenting.