LightShow.ino 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * Demo for RF remote switch receiver.
  3. * For details, see NewRemoteReceiver.h!
  4. *
  5. * Connect the transmitter to digital pin 11.
  6. *
  7. * This sketch demonstrates the use of the NewRemoteTransmitter class.
  8. *
  9. * When run, this sketch switches some pre-defined devices on and off in a loop.
  10. *
  11. * NOTE: the actual receivers have the address and group numbers in this example
  12. * are only for demonstration! If you want to duplicate an existing remote, please
  13. * try the "retransmitter"-example instead.
  14. *
  15. * To use this actual example, you'd need to "learn" the used code in the receivers
  16. * This sketch is unsuited for that.
  17. *
  18. */
  19. #include <NewRemoteTransmitter.h>
  20. // Create a transmitter on address 123, using digital pin 11 to transmit,
  21. // with a period duration of 260ms (default), repeating the transmitted
  22. // code 2^3=8 times.
  23. NewRemoteTransmitter transmitter(123, 11, 260, 3);
  24. void setup() {
  25. }
  26. void loop() {
  27. // Switch unit 2 off
  28. transmitter.sendUnit(2, false);
  29. // Switch all devices in the group off
  30. transmitter.sendGroup(false);
  31. // Set unit 1 to dim-level 3 (range 0-15)
  32. transmitter.sendDim(1, 3);
  33. // Wait 5 seconds
  34. delay(5000);
  35. // Switch unit 2 on
  36. transmitter.sendUnit(2, true);
  37. // Switch all devices in the group on
  38. transmitter.sendGroup(true);
  39. // Set unit 1 to dim-level 15, full brightness.
  40. transmitter.sendDim(1, 15);
  41. // Wait 5 seconds
  42. delay(5000);
  43. }