mc_workshop

LCD RGB

Apr 16th, 2021
493
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //mcworkshop.it - free code - aprile 2021
  2. //LCD RGB Grove V4.0
  3. #include <Wire.h>
  4. #include "rgb_lcd.h"
  5. rgb_lcd lcd;
  6. const int colorR = 0;
  7. const int colorG = 0;
  8. const int colorB = 0;
  9. void setup()
  10. {
  11.  lcd.begin(16, 2);
  12.  lcd.setRGB(colorR, colorG, colorB);
  13.  lcd.setCursor(1, 0);
  14.  lcd.print("scrivete quello");
  15.  lcd.setCursor(0, 1);
  16.  lcd.print("che vi pare");
  17.  delay(100);
  18. }
  19. void loop()
  20. {
  21.  lcd.setCursor(0, 1);
  22.  lcd.setRGB(255, 0, 0);
  23.  delay (1000);
  24.  lcd.setRGB(0, 255, 0);
  25.  delay (1000);
  26.  lcd.setRGB(0, 0, 255);
  27.  delay (1000);
  28. }
  29.  
  30. sostituite il void loop #1
  31. void loop()
  32. {
  33.  lcd.setCursor(0, 1);
  34.  lcd.setRGB(255, 0, 255);
  35.  delay (1000);
  36.  lcd.setRGB(0, 255, 255);
  37.  delay (1000);
  38.  lcd.setRGB(0, 0, 255);
  39.  delay (1000);
  40. }
  41.  
  42. sostituite il void loop #2 funzione fade
  43. void loop()
  44. {
  45.  lcd.setCursor(0, 1);
  46.  for(int i = 0; i < 256; i++){
  47.      lcd.setRGB(255-i, i, 0);
  48.    delay(10);
  49.  }
  50.  for(int i = 0; i < 256; i++){
  51.      lcd.setRGB(0, 255-i, i);
  52.    delay(10);
  53.  }
  54.  for(int i = 0; i < 256; i++){
  55.      lcd.setRGB(i, 0, 255-i);
  56.    delay(10);
  57.  }
  58. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×