PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

39 Zeilen
959B

  1. /*
  2. Fades a line down the channels, with max value and duration based on
  3. the voltage of analog pin 0.
  4. Try grounding analog 0: everything should turn off.
  5. Try putting +5V into analog 0: everything should turn on.
  6. See the BasicUse example for hardware setup.
  7. Alex Leone <acleone ~AT~ gmail.com>, 2009-02-03 */
  8. #include "Tlc5940.h"
  9. #include "tlc_fades.h"
  10. TLC_CHANNEL_TYPE channel;
  11. void setup()
  12. {
  13. Tlc.init();
  14. }
  15. void loop()
  16. {
  17. if (tlc_fadeBufferSize < TLC_FADE_BUFFER_LENGTH - 2) {
  18. if (!tlc_isFading(channel)) {
  19. uint16_t duration = analogRead(0) * 2;
  20. int maxValue = analogRead(0) * 2;
  21. uint32_t startMillis = millis() + 50;
  22. uint32_t endMillis = startMillis + duration;
  23. tlc_addFade(channel, 0, maxValue, startMillis, endMillis);
  24. tlc_addFade(channel, maxValue, 0, endMillis, endMillis + duration);
  25. }
  26. if (channel++ == NUM_TLCS * 16) {
  27. channel = 0;
  28. }
  29. }
  30. tlc_updateFades();
  31. }