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.

36 satır
833B

  1. /* X10 blink
  2. Blinks an lamp on an X10 lamp module, set to Unit 1, House A
  3. Example was built using a PL513
  4. Also tested using a PSC04 unit
  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 by Tom Igoe
  9. modified July 2010 by Paul Stoffregen <paul@pjrc.com>
  10. */
  11. #include <x10.h>
  12. const int zeroCrossPin = 2;
  13. const int dataPin = 3;
  14. // set up a new x10 instance:
  15. x10 myHouse = x10(zeroCrossPin, dataPin);
  16. void setup() {
  17. Serial.begin(9600);
  18. }
  19. void loop() {
  20. Serial.println("Lights on:");
  21. myHouse.write(HOUSE_A, UNIT_1, 3);
  22. myHouse.write(HOUSE_A, ON, 3);
  23. delay(1000);
  24. Serial.println("Lights off:");
  25. myHouse.write(HOUSE_A, UNIT_1, 3);
  26. myHouse.write(HOUSE_A, OFF, 3);
  27. delay(1000);
  28. }