PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

42 linhas
909B

  1. /*
  2. X10 dimmer
  3. Dims and brightens an incandescent lamp on an X10
  4. lamp module. Example was built using a PL513
  5. X10 One-Way Interface Module from http://www.smarthome.com
  6. as the modem, and a Powerhouse X10 Lamp Module from Smarthome
  7. to plug the lamp in.
  8. created 15 June 2007
  9. by Tom Igoe
  10. */
  11. #include <x10.h>
  12. #define zcPin 2
  13. #define dataPin 3
  14. // set up a new x10 instance:
  15. x10 myHouse = x10(zcPin, dataPin);
  16. void setup() {
  17. Serial.begin(9600);
  18. // send a "Lights ON" command 3 times:
  19. myHouse.write(HOUSE_A, ON, 3);
  20. }
  21. void loop() {
  22. Serial.println("Lights up:");
  23. // send a "lights BRIGHT" command 19 times.
  24. // it takes 19 BRIGHT or DIM commands to get
  25. // an incandescent lamp dim or bright.
  26. myHouse.write(HOUSE_A, BRIGHT, 19);
  27. delay(500);
  28. Serial.println("Lights down:");
  29. // send a "lights DIM" command 19 times:
  30. myHouse.write(HOUSE_A, DIM, 19);
  31. delay(500);
  32. }