Circular LED Python Code?


#1

http://www.seeedstudio.com/wiki/Grove_-_Circular_LED

Do anyone have the python code for this ? I can only find the LED Bar sample, and the hardware pin are also different
LED Bar = DI,DCLK,VCC,GND
Circular LED = DCLK, DI, VCC, GND

I manage to run the LED Bar code on my Circular LED after i physically change the first 2 connector pins. It only run the first 10 LEDs as the program was written that way.

Can someone help to update the firmware in Arduino to run it ? Pls guide me on how to update the firmware also.
Million thanks.


#2

Are you using a GrovePi+?


#3

yes. I am using grovePi+


#4

We dont have the the examples and code for the circular LED right now. I just checked the source code for the circular LED and getting it to work with the arduino examples and library that seeed provides and it does look a bit different. However, since you have already have the LED bar code working, the first thing that you can try to modify is the LED Bar code so that it can work with the circular LED. You should changed https://github.com/DexterInd/GrovePi/blob/master/Firmware/Source/v1.2/grove_pi_v1_2_5/Grove_LED_Bar.h#L40 (__state) to long so that it is 4 bytes long and can accomodate all 24 LED’s). Then change max i to 24 here: https://github.com/DexterInd/GrovePi/blob/master/Firmware/Source/v1.2/grove_pi_v1_2_5/Grove_LED_Bar.cpp#L60 and change the level from 10 to 24 on line 88, 102 and 118 and change the index on line 143 to check for less than 24.

You can read the discussion here on how to start editing the firmware: http://www.dexterindustries.com/topic/grovepi-with-arduino-ide/#post-4158. Once you have the firmware working, you can upload it to the grovePi and see if it works.

Do let us know if this works.

-Karan


#5

Hi,

I tried editing to 24 but it doesnt work but i manage to got it work using another library from the original circular led arduino example.
Attached is the github code for it.

I add 2 libraries CircularLED.h and CircularLED.cpp. Added instructions for arduino is edited in the grove_pi_v1_2_6.ino under line 319, cmd[0] == 57

If any maker plan to use, you may also need to update “grovepi.py” - aka import grovepi library in python

Good luck to all makers and cheers


#6

Hi changfrancis,
The code changes and additions look great and thanks for adding the support in the firmware and software for the circular LED. It would be great if you could make the changes to the firmware and grovepi.py in the 1.2.6 folder since that is the one in active development here https://github.com/DexterInd/GrovePi/tree/master/Firmware/Source/v1.2/grove_pi_v1_2_6 and send a pull request so that others can use it too.

Thanks again for all the work.

-Karan