PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Welcome to DmxSimple. This library allows you to control DMX stage and
  2. ** architectural lighting and visual effects easily from Arduino. DmxSimple
  3. ** is compatible with the Tinker.it! DMX shield and all known DIY Arduino
  4. ** DMX control circuits.
  5. **
  6. ** DmxSimple is available from: http://code.google.com/p/tinkerit/
  7. ** Help and support: http://groups.google.com/group/dmxsimple */
  8. /* To use DmxSimple, you will need the following line. Arduino will
  9. ** auto-insert it if you select Sketch > Import Library > DmxSimple. */
  10. #include <DmxSimple.h>
  11. void setup() {
  12. /* The most common pin for DMX output is pin 3, which DmxSimple
  13. ** uses by default. If you need to change that, do it here. */
  14. DmxSimple.usePin(3);
  15. /* DMX devices typically need to receive a complete set of channels
  16. ** even if you only need to adjust the first channel. You can
  17. ** easily change the number of channels sent here. If you don't
  18. ** do this, DmxSimple will set the maximum channel number to the
  19. ** highest channel you DmxSimple.write() to. */
  20. DmxSimple.maxChannel(4);
  21. }
  22. void loop() {
  23. int brightness;
  24. /* Simple loop to ramp up brightness */
  25. for (brightness = 0; brightness <= 255; brightness++) {
  26. /* Update DMX channel 1 to new brightness */
  27. DmxSimple.write(1, brightness);
  28. /* Small delay to slow down the ramping */
  29. delay(10);
  30. }
  31. }