PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

x10_multi.pde 1.4KB

3 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. RFID-to-X10 reader
  3. Turns on and off AC appliances. Example was built using a PL513
  4. X10 One-Way Interface Module from http://www.smarthome.com
  5. as the modem, and two Powerhouse X10 Lamp Module from Smarthome
  6. to plug the lamps in.
  7. Set module 1 to house code A, unit code 1, and module 2
  8. to house code A, unit code 2.
  9. created 17 June 2007
  10. by Tom Igoe
  11. */
  12. // include the X10 library files:
  13. #include <x10.h>
  14. #define zcPin 2 // the zero crossing detect pin
  15. #define dataPin 3 // the X10 data out pin
  16. #define repeatTimes 1 // how many times each X10 message should repeat
  17. // in an electrically noisy environment, you can set repeatTimes higher.
  18. // set up a new x10 library instance:
  19. x10 myHouse = x10(zcPin, dataPin);
  20. void setup() {
  21. // begin serial:
  22. Serial.begin(9600);
  23. // Turn off all lights:
  24. myHouse.write(HOUSE_A, ALL_UNITS_OFF,repeatTimes);
  25. }
  26. void loop() {
  27. // Turn on first module:
  28. myHouse.write(HOUSE_A, UNIT_1,repeatTimes);
  29. myHouse.write(HOUSE_A, ON,repeatTimes);
  30. // Turn off second module:
  31. myHouse.write(HOUSE_A, UNIT_2,repeatTimes);
  32. myHouse.write(HOUSE_A, OFF,repeatTimes);
  33. delay(500);
  34. // Turn off first module:
  35. myHouse.write(HOUSE_A, UNIT_1,repeatTimes);
  36. myHouse.write(HOUSE_A, OFF,repeatTimes);
  37. // turn on second module:
  38. myHouse.write(HOUSE_A, UNIT_2,repeatTimes);
  39. myHouse.write(HOUSE_A, ON,repeatTimes);
  40. delay(500);
  41. }