Skip to content
Snippets Groups Projects
Commit 94e5094b authored by Zhiying Li's avatar Zhiying Li
Browse files

delete some useless code

parent 98b9c9a4
No related merge requests found
#include "LedPanel.h"
LedPanel::LedPanel(int pixelnum, int pixelpin){
led_num = pixelnum;
//pixels = Adafruit_NeoPixel(pixelnum, pixelpin, NEO_GRB + NEO_KHZ800);
}
void LedPanel::fullPanelLight(int r, int g, int b){
for (int i=0 ; i<led_num ; i++){
pixels.setPixelColor(i, r,g,b);
}
pixels.show();
}
void LedPanel::beginPanel(){
pixels.begin();
}
void LedPanel::resetPanel(){
for (int i=0 ; i<led_num ; i++){
pixels.setPixelColor(i, 0,0,0);
}
pixels.show();
}
void LedPanel::topLeftQuadrant(int r, int g, int b){
for (int i = 0; i<HORIZONTAL_SIZE/2; i++){
for (int j=0; j<VERTICAL_SIZE/2;j++){
pixels.setPixelColor(i+j*HORIZONTAL_SIZE, r, g, b);
}
}
pixels.show();
}
void LedPanel::bottomLeftQuadrant(int r, int g, int b){
for (int i = 0; i<HORIZONTAL_SIZE/2; i++){
for (int j=VERTICAL_SIZE/2; j<VERTICAL_SIZE;j++){
pixels.setPixelColor(i+j*HORIZONTAL_SIZE, r, g, b);
}
}
pixels.show();
}
void LedPanel::topRightQuadrant(int r, int g, int b){
for (int i = HORIZONTAL_SIZE/2; i<HORIZONTAL_SIZE; i++){
for (int j=0; j<VERTICAL_SIZE/2;j++){
pixels.setPixelColor(i+j*HORIZONTAL_SIZE, r, g, b);
}
}
pixels.show();
}
void LedPanel::bottomRightQuadrant(int r, int g, int b){
for (int i = HORIZONTAL_SIZE/2; i<HORIZONTAL_SIZE; i++){
for (int j=VERTICAL_SIZE/2; j<VERTICAL_SIZE;j++){
pixels.setPixelColor(i+j*HORIZONTAL_SIZE, r, g, b);
}
}
pixels.show();
}
void LedPanel::singleLED(int num, int r, int g, int b) {
pixels.setPixelColor(num, r, g, b);
pixels.show();
}
#ifndef LEDPANEL_H
#define LEDPANEL_H
#include <Adafruit_NeoPixel.h>
#define NUMPIXELS 32
#define PIN_PIXELS 32 // Use pin 32 for NeoPixels
const int HORIZONTAL_SIZE = 8;
const int VERTICAL_SIZE = 4;
class LedPanel {
private:
int led_num;
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN_PIXELS, NEO_GRB + NEO_KHZ800);
public:
LedPanel(int pixelnum, int pixelpin);
void fullPanelLight(int r, int b, int g);
void resetPanel();
void topLeftQuadrant(int r, int g, int b);
void bottomLeftQuadrant(int r, int g, int b);
void topRightQuadrant(int r, int g, int b);
void bottomRightQuadrant(int r, int g, int b);
void beginPanel();
void singleLED(int num, int r, int g, int b);
};
#endif
100100000000+-+-
000000000000++++
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment