The Lionbit Support Library provides easy-to-use functions to control features on the Lionbit development board, including its onboard RGB LED (NeoPixel) and custom tone generation with predefined musical notes. This library simplifies working with these features by providing pre-built functions for LED control, music tones, and more.
- NeoPixel RGB LED Control:
- Set colors with simple RGB values (0–255).
- Predefined fading effect function for seamless color transitions.
- Fully compatible with the Adafruit NeoPixel library.
- Custom Tone Generation:
- Play custom music tones with predefined musical notes.
- Simple function to generate sound frequencies directly from the library.
- Pre-configured Pin Definitions:
- No need to manually configure pins for onboard components.
- Open the Arduino IDE.
- Go to
Sketch > Include Library > Manage Libraries
. - Search for Lionbit Support Library and click Install.
- Ensure the Adafruit NeoPixel library is also installed. It is a dependency of this library.
-
Include the library in your Arduino sketch:
#include "lionbitsupport.h"
-
Initialize the RGB LED in the
setup()
function:void setup() { setupRGB(); // Initialize the onboard NeoPixel RGB LED }
-
Use the provided functions to control the RGB LED:
void loop() { setRGBColor(255, 0, 0); // Red delay(1000); setRGBColor(0, 255, 0); // Green delay(1000); setRGBColor(0, 0, 255); // Blue delay(1000); fadeRGB(); // Fading effect }
-
Use the library's predefined notes to play sounds:
void setup() { pinMode(8, OUTPUT); // Set the buzzer pin } void loop() { playTone(8, NOTE_C4, 500); // Play Middle C for 500ms delay(500); playTone(8, NOTE_D4, 500); // Play D note for 500ms delay(500); }
-
Available Notes:
- Predefined musical notes (e.g.,
NOTE_C4
,NOTE_D4
,NOTE_E4
) are included for quick use.
- Predefined musical notes (e.g.,
setupRGB()
: Initializes the NeoPixel LED.setRGBColor(int red, int green, int blue)
: Sets the RGB LED color with specified brightness for each color (0–255).fadeRGB()
: Demonstrates a fade effect by cycling through colors.
-
playTone(int pin, int note, int duration)
:- Plays a tone on the specified pin.
- Parameters:
pin
: The pin connected to the buzzer.note
: Predefined musical note.duration
: Duration of the tone in milliseconds.
-
Predefined Notes:
- Includes a wide range of musical notes such as
NOTE_C4
,NOTE_D4
,NOTE_E4
, etc.
- Includes a wide range of musical notes such as
This library requires the following dependencies, which are automatically installed when you install this library via the Arduino Library Manager:
#include "lionbitsupport.h"
void setup() {
setupRGB();
}
void loop() {
setRGBColor(255, 0, 0); // Red
delay(1000);
setRGBColor(0, 255, 0); // Green
delay(1000);
setRGBColor(0, 0, 255); // Blue
delay(1000);
fadeRGB();
}
#include "lionbitsupport.h"
void setup() {
pinMode(8, OUTPUT);
}
void loop() {
playTone(8, NOTE_C4, 500);
delay(500);
playTone(8, NOTE_D4, 500);
delay(500);
playTone(8, NOTE_E4, 500);
delay(500);
}
This library enhances the usability of the Lionbit development board by integrating RGB LED control and tone generation seamlessly.
This pull request integrates support for:
-
NeoPixel RGB LED:
- Added functions to control the onboard NeoPixel LED, including color setting and fading effects.
- Provided a seamless setup process using
setupRGB()
and utility functions.
-
Custom Tone Generation:
- Included functionality for generating music tones with predefined musical notes.
- Added support for playing tones on a buzzer with accurate note duration and frequency.
-
Documentation:
- Updated the
README.md
to reflect the new features, including examples for RGB LED control and tone generation.
- Updated the
- Added
Adafruit_NeoPixel
dependency for NeoPixel LED support. - Introduced
setupRGB()
,setRGBColor()
, andfadeRGB()
functions for RGB LED. - Added tone generation support with predefined notes and a
playTone()
function. - Updated
README.md
to include detailed usage instructions, examples, and dependencies.
- Simplifies the use of onboard features for developers.
- Enhances the library's utility for educational and hobbyist projects.
- Provides a professional interface for controlling NeoPixel LEDs and generating tones.
- Verified RGB LED functions (
setRGBColor
,fadeRGB
) with various colors and effects. - Tested tone generation with predefined notes on a connected buzzer.
- Ensured compatibility with the Arduino IDE.
- Install the updated library using the Arduino Library Manager.
- Run the example sketches provided in the
README.md
. - Observe the RGB LED and tone generation outputs for expected behavior.
This pull request makes the Lionbit Support Library a comprehensive solution for using the onboard features of the Lionbit development board.