-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ff9a2d1
Showing
8 changed files
with
601 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,36 @@ | |||
X10 transmission library for Arduino version 0.4 | |||
|
|||
Copyright (c) 2007 by Tom Igoe (tom.igoe@gmail.com) | |||
|
|||
This file is free software; you can redistribute it and/or modify | |||
it under the terms of either the GNU General Public License version 2 | |||
or the GNU Lesser General Public License version 2.1, both as | |||
published by the Free Software Foundation. | |||
|
|||
|
|||
This is a new version of the X10 library for Arduino that I wrote originally in | |||
2007 for my book "Making Things Talk". It's been refactored with a new API, | |||
based on the Wire library API for Arduino 1.0, which David Mellis recently refactored. | |||
It inherits from the Stream class so that it can use the write() and read() methods | |||
from that class. | |||
|
|||
I haven't yet added read functionality, but if anyone wants to add that and send me | |||
a pull request I'd be happy to see it. | |||
|
|||
To use it, you must be using the new-extension branch of the current Arduino repository, | |||
which can be found here: https://github.com/arduino/Arduino/tree/new-extension | |||
That repo should become Arduino 1.0 by June or July 2011. | |||
|
|||
More on X10 and the previous documentation here: | |||
http://www.arduino.cc/en/Tutorial/x10 | |||
|
|||
|
|||
Original library (0.1) | |||
Timing bug fixes (0.2) | |||
#include bug fixes for 0012 (0.3) | |||
Refactored version following Wire lib API (0.4) | |||
|
|||
Enjoy. | |||
|
|||
Tom Igoe | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,43 @@ | |||
/* | |||
X10 blink | |||
Blinks an lamp on an X10 lamp module. | |||
Example was built using a PL513 | |||
X10 One-Way Interface Module from http://www.smarthome.com | |||
as the modem, and a Powerhouse X10 Lamp Module from Smarthome | |||
to plug the lamp in. | |||
created 15 June 2007 | |||
modified 6 May 2011 | |||
by Tom Igoe | |||
*/ | |||
#include <x10.h> | |||
|
|||
const int rxPin = 3; // data receive pin | |||
const int txPin = 4; // data transmit pin | |||
const int zcPin = 2; // zero crossing pin | |||
|
|||
|
|||
void setup() { | |||
// initialize serial and X10: | |||
Serial.begin(9600); | |||
x10.begin(rxPin, txPin, zcPin); | |||
} | |||
|
|||
void loop() { | |||
// open transmission to house code A: | |||
x10.beginTransmission(A); | |||
Serial.println("Lights on:"); | |||
// send a "lights on" command: | |||
x10.write(ON); | |||
|
|||
delay(500); | |||
Serial.println("Lights off:"); | |||
// send a "lights off" command: | |||
x10.write(OFF); | |||
x10.endTransmission(); | |||
delay(500); | |||
} | |||
|
|||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,45 @@ | |||
/* | |||
X10 dimmer | |||
Dims and brightens an incandescent lamp on an X10 | |||
lamp module. Example was built using a PL513 | |||
X10 One-Way Interface Module from http://www.smarthome.com | |||
as the modem, and a Powerhouse X10 Lamp Module from Smarthome | |||
to plug the lamp in. | |||
created 15 June 2007 | |||
modified 6 May 2011 | |||
by Tom Igoe | |||
*/ | |||
|
|||
|
|||
#include <x10.h> | |||
|
|||
const int rxPin = 3; // data receive pin | |||
const int txPin = 4; // data transmit pin | |||
const int zcPin = 2; // zero crossing pin | |||
|
|||
void setup() { | |||
Serial.begin(9600); | |||
x10.begin(rxPin, txPin, zcPin); | |||
} | |||
|
|||
void loop() { | |||
|
|||
x10.beginTransmission(A); | |||
Serial.println("Lights on:"); | |||
// send a "fade up" command 19 times: | |||
for (int steps = 0; steps < 19; steps++) { | |||
x10.write(BRIGHT); | |||
} | |||
delay(500); | |||
Serial.println("Lights off:"); | |||
// send a "fade down" command 19 times: | |||
for (int steps = 0; steps < 19; steps++) { | |||
x10.write(DIM); | |||
} | |||
x10.endTransmission(); | |||
delay(500); | |||
} | |||
|
|||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,53 @@ | |||
/* | |||
RFID-to-X10 reader | |||
Turns on and off AC appliances. Example was built using a PL513 | |||
X10 One-Way Interface Module from http://www.smarthome.com | |||
as the modem, and two Powerhouse X10 Lamp Module from Smarthome | |||
to plug the lamps in. | |||
Set module 1 to house code unit code 1, and module 2 | |||
to house code unit code 2. | |||
created 17 June 2007 | |||
modified 6 May 2011 | |||
by Tom Igoe | |||
*/ | |||
|
|||
// include the X10 library files: | |||
#include <x10.h> | |||
|
|||
const int rxPin = 3; // data receive pin | |||
const int txPin = 4; // data transmit pin | |||
const int zcPin = 2; // zero crossing pin | |||
|
|||
|
|||
void setup() { | |||
// begin serial: | |||
Serial.begin(9600); | |||
x10.begin(rxPin, txPin, zcPin); | |||
// Turn off all lights: | |||
x10.beginTransmission(A); | |||
x10.write(ALL_UNITS_OFF); | |||
x10.endTransmission(); | |||
} | |||
|
|||
void loop() { | |||
x10.beginTransmission(A); | |||
// Turn on first module: | |||
x10.write(UNIT_1); | |||
x10.write(ON); | |||
// Turn off second module: | |||
x10.write(UNIT_2); | |||
x10.write(OFF); | |||
delay(500); | |||
// Turn off first module: | |||
x10.write(UNIT_1); | |||
x10.write(OFF); | |||
// turn on second module: | |||
x10.write(UNIT_2); | |||
x10.write(ON); | |||
delay(500); | |||
x10.endTransmission(); | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,74 @@ | |||
####################################### | |||
# Syntax Coloring Map For Test | |||
####################################### | |||
|
|||
####################################### | |||
# Datatypes (KEYWORD1) | |||
####################################### | |||
|
|||
x10 KEYWORD1 | |||
|
|||
####################################### | |||
# Methods and Functions (KEYWORD2) | |||
####################################### | |||
|
|||
write KEYWORD2 | |||
|
|||
###################################### | |||
# Instances (KEYWORD2) | |||
####################################### | |||
|
|||
|
|||
####################################### | |||
# Constants (LITERAL1) | |||
####################################### | |||
A LITERAL1 | |||
B LITERAL1 | |||
C LITERAL1 | |||
D LITERAL1 | |||
E LITERAL1 | |||
F LITERAL1 | |||
G LITERAL1 | |||
H LITERAL1 | |||
I LITERAL1 | |||
J LITERAL1 | |||
K LITERAL1 | |||
L LITERAL1 | |||
M LITERAL1 | |||
N LITERAL1 | |||
O LITERAL1 | |||
P LITERAL1 | |||
|
|||
UNIT_1 LITERAL1 | |||
UNIT_2 LITERAL1 | |||
UNIT_3 LITERAL1 | |||
UNIT_4 LITERAL1 | |||
UNIT_5 LITERAL1 | |||
UNIT_6 LITERAL1 | |||
UNIT_7 LITERAL1 | |||
UNIT_8 LITERAL1 | |||
UNIT_9 LITERAL1 | |||
UNIT_10 LITERAL1 | |||
UNIT_11 LITERAL1 | |||
UNIT_12 LITERAL1 | |||
UNIT_13 LITERAL1 | |||
UNIT_14 LITERAL1 | |||
UNIT_15 LITERAL1 | |||
UNIT_16 LITERAL1 | |||
|
|||
ALL_UNITS_OFF LITERAL1 | |||
ALL_LIGHTS_ON LITERAL1 | |||
ON LITERAL1 | |||
OFF LITERAL1 | |||
DIM LITERAL1 | |||
BRIGHT LITERAL1 | |||
ALL_LIGHTS_OFF LITERAL1 | |||
EXTENDED_CODE LITERAL1 | |||
HAIL_REQUEST LITERAL1 | |||
HAIL_ACKNOWLEDGE LITERAL1 | |||
PRE_SET_DIM LITERAL1 | |||
EXTENDED_DATA LITERAL1 | |||
STATUS_ON LITERAL1 | |||
STATUS_OFF LITERAL1 | |||
STATUS_REQUEST LITERAL1 | |||
|
Oops, something went wrong.