Turn on the led (Pin 13) on the Arduino board. This block does not need any sensor or external LED.
void setup() {pinMode(13, OUTPUT);}void loop() {}
Show text on the grove lcd 1602 display. Connect lcd on I2C port. 0x3e is the grove module I2C address. 0x3f and 0x27 use the PCF8574 I2C adapter module.
#include <Wire.h>#include <rgb_lcd.h>rgb_lcd lcdRgb;void setup() {lcdRgb.begin(16, 2);}void loop() {}
Enable to clear the entire lcd text. Connect lcd on I2C port. 0x3e is the grove module I2C address. 0x3f and 0x27 use the PCF8574 I2C adapter module.
#include <Wire.h>#include <rgb_lcd.h>rgb_lcd lcdRgb;void setup() {lcdRgb.begin(16, 2);}void loop() {}
Enable to switch ON/OFF the display. Connect lcd on I2C port. 0x3e is the grove module I2C address. 0x3f and 0x27 use the PCF8574 I2C adapter module.
#include <Wire.h>#include <rgb_lcd.h>rgb_lcd lcdRgb;void setup() {lcdRgb.begin(16, 2);}void loop() {}
Block controlling the backlight of the Grove LCD 16x2 characters module. Give a value between 0 and 255 for illuminate the display in red, green and blue. Connect LCD on an I2C port.
#include <Wire.h>#include <rgb_lcd.h>rgb_lcd lcdRgb;void setup() {lcdRgb.begin(16, 2);}void loop() {}
Block controlling the backlight of the Grove LCD 16x2 characters module. Choice color in palette for illuminate the display. Connect LCD on an I2C port.
#include <Wire.h>#include <rgb_lcd.h>rgb_lcd lcdRgb;void setup() {lcdRgb.begin(16, 2);}void loop() {}
Enable to define LED number of neopixelon digital pins from D0 up through D13. This block have to be used in setup.
#include <Adafruit_NeoPixel.h>#define NP_LED_COUNT_2 20Adafruit_NeoPixel Neopixel_2(NP_LED_COUNT_2, 2, NEO_GRB + NEO_KHZ800);void setup() {Neopixel_2.begin();}void loop() {}
Enable to control each LED color of neopixel as (R,G,B) from 0 to 255 on digital pins from D0 up through D13.
#include <Adafruit_NeoPixel.h>#define NP_LED_COUNT_2 30Adafruit_NeoPixel Neopixel_2(NP_LED_COUNT_2, 2, NEO_GRB + NEO_KHZ800);void setup() {Neopixel_2.begin();}void loop() {}
Enable to control each LED color of neopixel on digital pins from D0 up through D13.
#include <Adafruit_NeoPixel.h>#define NP_LED_COUNT_2 30Adafruit_NeoPixel Neopixel_2(NP_LED_COUNT_2, 2, NEO_GRB + NEO_KHZ800);void setup() {Neopixel_2.begin();}void loop() {}
Enable to control all LED of neopixel to the choosed colour value as (R,G,B) from 0 to 255. Use P15 to set Maqueen neopixel.
#include <Adafruit_NeoPixel.h>#define NP_LED_COUNT_2 30Adafruit_NeoPixel Neopixel_2(NP_LED_COUNT_2, 2, NEO_GRB + NEO_KHZ800);void neopixel_showAllLed(Adafruit_NeoPixel *neoPx, uint8_t ledCount, uint8_t r, uint8_t g, uint8_t b) {for (int i=0; i<ledCount; i++) {neoPx->setPixelColor(i, neoPx->Color(r, g, b));}neoPx->show();}void setup() {Neopixel_2.begin();}void loop() {}
Enable to control all LED of neopixel to the choosed colour value. Use P15 to set Maqueen neopixel.
#include <Adafruit_NeoPixel.h>#define NP_LED_COUNT_2 30Adafruit_NeoPixel Neopixel_2(NP_LED_COUNT_2, 2, NEO_GRB + NEO_KHZ800);void neopixel_showAllLed(Adafruit_NeoPixel *neoPx, uint8_t ledCount, uint8_t r, uint8_t g, uint8_t b) {for (int i=0; i<ledCount; i++) {neoPx->setPixelColor(i, neoPx->Color(r, g, b));}neoPx->show();}void setup() {Neopixel_2.begin();}void loop() {}
Enable to show a rainbow on neopixel module, set pin and the number of LED.
#include <Adafruit_NeoPixel.h>#define NP_LED_COUNT_2 30Adafruit_NeoPixel Neopixel_2(NP_LED_COUNT_2, 2, NEO_GRB + NEO_KHZ800);void neopixel_showAllLed(Adafruit_NeoPixel *neoPx, uint8_t ledCount, uint8_t r, uint8_t g, uint8_t b) {for (int i=0; i<ledCount; i++) {neoPx->setPixelColor(i, neoPx->Color(r, g, b));}neoPx->show();}void neopixel_rainbow(Adafruit_NeoPixel *neoPx, uint8_t ledCount) {uint8_t R = 255;uint8_t G = 50;uint8_t B = 50;for (G; G<254; G=G+5) {neopixel_showAllLed(neoPx, ledCount, R, G, B);delay(5);}for (R; R>49; R=R-5) {neopixel_showAllLed(neoPx, ledCount, R, G, B);delay(5);}for (B; B<254; B=B+5) {neopixel_showAllLed(neoPx, ledCount, R, G, B);delay(5);}for (G; G>49; G=G-5) {neopixel_showAllLed(neoPx, ledCount, R, G, B);delay(5);}for (R; R<254; R=R+5) {neopixel_showAllLed(neoPx, ledCount, R, G, B);delay(5);}for (B; B>49; B=B-5) {neopixel_showAllLed(neoPx, ledCount, R, G, B);delay(5);}}void setup() {Neopixel_2.begin();}void loop() {}
Enable write text on OLED display of size 128x64 px. Connect the OLED display on I2C port.
#include <Wire.h>#include <SeeedOLED.h>void SeeedOled_setup() {SeeedOled.init();SeeedOled.clearDisplay();SeeedOled.setNormalDisplay();SeeedOled.setPageMode();}void setup() {Wire.begin();SeeedOled_setup();}void loop() {}
Enable to draw icon, at position (x,y) on grove OLED display with bitmap array of size 8x8 px (like character). Connect the OLED display on I2C port.
#include <Wire.h>#include <SeeedOLED.h>#include <avr/pgmspace.h>static const uint8_t HEART [] PROGMEM = {0x0e, 0x1f, 0x3f, 0x7e, 0x3f, 0x1f, 0x0e, 0x00};void SeeedOled_setup() {SeeedOled.init();SeeedOled.clearDisplay();SeeedOled.setNormalDisplay();SeeedOled.setPageMode();}void SeeedOled_drawIcon(uint8_t icon [] PROGMEM, uint8_t x, uint8_t y) {SeeedOled.setTextXY(x, y);for (int i; i<8; i++) SeeedOled.sendData(pgm_read_byte(&icon[i]));}void setup() {Wire.begin();SeeedOled_setup();}void loop() {}
Enable to draw logo on grove OLED display with bitmap array of size 128x64 px. Connect the OLED display on I2C port.
#include <Wire.h>#include <SeeedOLED.h>#include <avr/pgmspace.h>static const uint8_t vittascienceLogo [] PROGMEM = {// logo_vittascience, 128x64 px0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x7c, 0x7c, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x80, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x1c, 0x7e, 0xfc, 0xf8, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,0xf0, 0xfc, 0x7e, 0x1c, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x18,0x1c, 0x1e, 0xff, 0xff, 0xff, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x00, 0x18, 0x1c, 0x1e,0xff, 0xff, 0xff, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,0x3c, 0x3c, 0x1c, 0x1e, 0x1e, 0x1e, 0x1e, 0x1c, 0x3c, 0xfc, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x1f, 0x7f, 0xfe, 0xf8, 0xc0, 0x00, 0xc0, 0xf8, 0xfe, 0x3f,0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf0, 0xf8, 0x38,0x3c, 0x1c, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x8e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x1f, 0x1f, 0x1f, 0x07, 0x01, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x07, 0x0f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1c, 0x1e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,0x07, 0x0f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1c, 0x1e, 0x0e, 0x00, 0x00, 0x00, 0x01, 0x07, 0x0f, 0x0f,0x1e, 0x1c, 0x1c, 0x1c, 0x1e, 0x0e, 0x0f, 0x07, 0x07, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0xe0, 0xf0, 0xf8, 0x78, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x78, 0xf0, 0xe0, 0x00,0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf0, 0x78, 0x38, 0x38, 0x3c, 0x3c, 0x3c, 0x3c,0x78, 0x78, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0xc0, 0xe0, 0xf0, 0x78, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x78, 0x70, 0xf0, 0xe0, 0xc0,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0xf8, 0xe0, 0xf0, 0x70, 0x78, 0x38, 0x38, 0x38,0x38, 0x78, 0xf0, 0xf0, 0xe0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf0,0x78, 0x38, 0x38, 0x3c, 0x3c, 0x3c, 0x3c, 0x78, 0x78, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0xc0,0xe0, 0xf0, 0x78, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x78, 0x70, 0xf0, 0xe0, 0xc0, 0x00, 0x00,0x00, 0x00, 0x0f, 0x1f, 0x1f, 0x3c, 0x3c, 0x38, 0x38, 0x78, 0x70, 0x70, 0xf0, 0xe0, 0xe0, 0x00,0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf8,0xff, 0xff, 0xff, 0xb9, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x39, 0x3f, 0x3f,0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x01, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff,0xff, 0xb9, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x39, 0x3f, 0x3f, 0x3e, 0x00,0x00, 0x00, 0x0e, 0x1e, 0x3e, 0x3c, 0x38, 0x38, 0x38, 0x38, 0x38, 0x3c, 0x3f, 0x1f, 0x0f, 0x00,0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x1e, 0x3c, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,0x3c, 0x1e, 0x0e, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,0x03, 0x07, 0x1f, 0x1f, 0x1e, 0x3c, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x3c, 0x3c, 0x3e, 0x1c,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x3f, 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x1e,0x3c, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x3c, 0x1e, 0x0e, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x07,0x0f, 0x1f, 0x1e, 0x3c, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x3c, 0x3c, 0x3e, 0x1c, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x3e, 0x3e, 0x3e, 0x1c, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};void SeeedOled_setup() {SeeedOled.init();SeeedOled.clearDisplay();SeeedOled.setNormalDisplay();SeeedOled.setPageMode();}void setup() {Wire.begin();SeeedOled_setup();}void loop() {}
Enable to clear the entire grove oled screen. Connect the OLED display on I2C port.
#include <Wire.h>#include <SeeedOLED.h>void SeeedOled_setup() {SeeedOled.init();SeeedOled.clearDisplay();SeeedOled.setNormalDisplay();SeeedOled.setPageMode();}void setup() {Wire.begin();SeeedOled_setup();}void loop() {}
Enable to switch on or switch off the LED socket kit Grove (0 or 1) on digital pins D0 up through D13.
#define PIN_LED_MODULE_2 2void setup() {pinMode(PIN_LED_MODULE_2, OUTPUT);}void loop() {}
Enable to set the LED intensity from 0 to 255 on PWM pins.
#define PIN_LED_MODULE_3 3void setup() {pinMode(PIN_LED_MODULE_3, OUTPUT);}void loop() {}
Enable to set the LED intensity from 0 to 100 (%) on PWM pins. When using the module for the first time, RGB are set to 0. Use a screwdriver on R, G or B behind module to control LED color.
#define PIN_VARIABLE_COLOR_LED_3 3void setup() {pinMode(PIN_VARIABLE_COLOR_LED_3, OUTPUT);}void loop() {}
Enable to show numbers or temperature on grove 4-digit display (TM1637) on digital pins from D0 up through D13.
#include <TM1637.h>#define PIN_4_DIGIT_DISPLAY_CLK_2 2#define PIN_4_DIGIT_DISPLAY_DIO_3 3TM1637 tm1637_2(PIN_4_DIGIT_DISPLAY_CLK_2, PIN_4_DIGIT_DISPLAY_DIO_3);void setup() {pinMode(PIN_4_DIGIT_DISPLAY_CLK_2, OUTPUT);pinMode(PIN_4_DIGIT_DISPLAY_DIO_3, OUTPUT);tm1637_2.init();tm1637_2.set(7); // Maximum brightness}void loop() {}
Enable to show clock on grove 4-digit display (TM1637) on digital pins from D0 up through D13. Warning, getting real clock is possible only if arduino stay in power on mode.
#include <TM1637.h>#define PIN_4_DIGIT_DISPLAY_CLK_2 2#define PIN_4_DIGIT_DISPLAY_DIO_3 3TM1637 tm1637_2(PIN_4_DIGIT_DISPLAY_CLK_2, PIN_4_DIGIT_DISPLAY_DIO_3);int chrono0Clk = 0;//Warning, the clock is retrieved by browser when arduino code is uploaded.//If arduino is powered off, time will not flow.const uint8_t MIN_START = 30;const uint8_t HOUR_START = 0;int tm_clock[2];void setClock(int t[]) {int min0=(millis()-chrono0Clk)/1000/60;int h0=min0/60;int last_mins=MIN_START+(int)min0-(int)h0*60;if (last_mins>59) {t[1]=last_mins-60;t[0]=HOUR_START+(int)h0+1;} else {t[1]=last_mins;t[0]=HOUR_START+(int)h0;}}void setup() {pinMode(PIN_4_DIGIT_DISPLAY_CLK_2, OUTPUT);pinMode(PIN_4_DIGIT_DISPLAY_DIO_3, OUTPUT);tm1637_2.init();tm1637_2.set(7); // Maximum brightness}void loop() {}
Enable to show temperature on grove 4-digit display (TM1637) on digital pins from D0 up through D13.
#include <TM1637.h>#define PIN_4_DIGIT_DISPLAY_CLK_2 2#define PIN_4_DIGIT_DISPLAY_DIO_3 3TM1637 tm1637_2(PIN_4_DIGIT_DISPLAY_CLK_2, PIN_4_DIGIT_DISPLAY_DIO_3);int8_t tm_digits[4];void setTemperature(int8_t digits[], float t) {if (t<100 && t>-10) {if (t<-1) {digits[0] = '-';digits[1] = (int8_t)abs((int)t);} else {digits[0] = (int8_t)((int)t/10);digits[1] = (int8_t)((int)t%10);}} else {digits[0] = '_';digits[1] = '_';}digits[2] = '*';digits[3] = 'C';}void setup() {pinMode(PIN_4_DIGIT_DISPLAY_CLK_2, OUTPUT);pinMode(PIN_4_DIGIT_DISPLAY_DIO_3, OUTPUT);tm1637_2.init();tm1637_2.set(7); // Maximum brightness}void loop() {}
Enable to show level of input value on grove LED bar display (MY9221) on digital pins from D0 up through D13.
#include <Grove_LED_Bar.h>#define PIN_LED_BAR_DI_3 3#define PIN_LED_BAR_DCKI_2 2Grove_LED_Bar bar_3(PIN_LED_BAR_DI_3, PIN_LED_BAR_DCKI_2, 0);void setup() {pinMode(PIN_LED_BAR_DI_3, OUTPUT);pinMode(PIN_LED_BAR_DCKI_2, OUTPUT);bar_3.begin();}void loop() {}
يتيح تغيير اتجاه مصابيح LED في وحدة شريط الرسم البياني Grove (MY9221)، من الأخضر إلى الأحمر أو من الأحمر إلى الأخضر.
#include <Grove_LED_Bar.h>#define PIN_LED_BAR_DI_3 3#define PIN_LED_BAR_DCKI_2 2Grove_LED_Bar bar_3(PIN_LED_BAR_DI_3, PIN_LED_BAR_DCKI_2, 0);void setup() {pinMode(PIN_LED_BAR_DI_3, OUTPUT);pinMode(PIN_LED_BAR_DCKI_2, OUTPUT);bar_3.begin();}void loop() {}