Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <U8x8lib.h>
- #include <FastLED.h>
- #ifdef U8X8_HAVE_HW_SPI
- #include <SPI.h>
- #endif
- //OLED
- U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);
- //LED Stripe
- #define LED_PIN 5
- #define COLOR_ORDER GRB
- #define CHIPSET WS2813
- #define NUM_LEDS 30
- #define BRIGHTNESS 50
- #define FRAMES_PER_SECOND 60
- CRGB leds[NUM_LEDS];
- void setup() {
- delay(3000); // sanity delay
- //initOLED
- u8x8.begin();
- //init LED Stripe
- FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
- FastLED.setBrightness( BRIGHTNESS );
- }
- void loop()
- {
- resetStripe();
- updateOLED();
- FastLED.show();
- FastLED.delay(1000 / FRAMES_PER_SECOND);
- }
- void resetStripe(){
- for(int i = 0; i < NUM_LEDS; i++) {
- leds[i] = CRGB::Green;
- }
- }
- void updateOLED(){
- u8x8.clearDisplay();
- u8x8.setFont(u8x8_font_px437wyse700a_2x2_r);
- u8x8.drawString(0, 0, "Hello World");
- }
Advertisement
Add Comment
Please, Sign In to add comment