Grove LED Bar

Grove – LED Bar is comprised of a 10 segment LED gauge bar and an MY9221 LED controlling chip. It can be used as an indicator for remaining battery life, voltage, water level, music volume or other values that require a gradient display. There are 10 LED bars in the LED bar graph: one red, one yellow, one light green, and seven green bars. Demo code is available to get you up and running quickly. It lights up the LEDs sequentially from red to green, so the entire bar graph is lit up in the end. Want to go further? Go ahead and code your own effect.

Features

  • Input Voltage: 3.3V/5V

  • Each LED segment can be controlled individually via code

  • Intuitive display

  • Flexible power option, supports 3-5.5DC

  • Available demo code

  • Suli-compatible Library

Platforms Supported

Note More details about Suli-compatible Library, please refer to Suli

Demonstration

With Arduino

This is a simple demo which can you help you to start with Grove - LED Bar quickly.

We need a Seeeduino V3.0 and a Grove - Base Shield as well.

Hardware Installation

Plug the Grove - LED Bar onto the digital port 8 on Grove - Base Shield, and then plug the base shield onto Arduino.

Download Code and Upload

You can download the library in github, click here, then extract it to libraries folder of Arduino.

Then open Arduino IDE, File -> examples -> LED_Bar -> Level, you can open the demo code.

Click Upload to Upload the code, if you have any problem about how to start Arduino, please click here for some help.

Working Now

Your Grove - LED Bar is working now, it's shine.

With Raspberry Pi

1.You should have got a raspberry pi and a grovepi or grovepi+.

2.You should have completed configuring the development enviroment, otherwise follow here.

3.Connection

  • Plug the sensor to grovepi socket D3 by using a grove cable.

4.Navigate to the demos' directory:

  • To see the code

    ```

    import time

    import grovepi

    import random

Connect the Grove LED Bar to digital port D5

DI,DCKI,VCC,GND

ledbar = 5

grovepi.pinMode(ledbar,"OUTPUT") time.sleep(1) i = 0

LED Bar methods

grovepi.ledBar_init(pin,orientation)

grovepi.ledBar_orientation(pin,orientation)

grovepi.ledBar_setLevel(pin,level)

grovepi.ledBar_setLed(pin,led,state)

grovepi.ledBar_toggleLed(pin,led)

grovepi.ledBar_setBits(pin,state)

grovepi.ledBar_getBits(pin)

sudo python grove_ledbar.py

cd yourpath/GrovePi/Firmware sudo ./firmware_update.sh

Resources

Last updated

Was this helpful?