Line 1... |
Line 1... |
1 |
// Lamps controller |
1 |
// Lamps controller |
2 |
#define VERSION "$Revision: 3651 $" |
2 |
#define VERSION "$Revision: 3652 $" |
3 |
|
3 |
|
4 |
|
4 |
|
5 |
#include <OneWire.h> |
5 |
#include <OneWire.h> |
6 |
#include <EEPROM.h> |
6 |
#include <EEPROM.h> |
7 |
|
7 |
|
Line 29... |
Line 29... |
29 |
|
29 |
|
30 |
void info () // Print an information string |
30 |
void info () // Print an information string |
31 |
{ |
31 |
{ |
32 |
Serial.print("Lamps Controller "); |
32 |
Serial.print("Lamps Controller "); |
33 |
Serial.println(VERSION); |
33 |
Serial.println(VERSION); |
34 |
Serial.println("Commands: abcdefghABCDEFGHiS"); |
34 |
Serial.println("Commands: abcdefghABCDEFGHiRS"); |
- |
|
35 |
Serial.println("t1=a t2=b ... t8=h"); |
- |
|
36 |
Serial.println("a = ON t1 / A = OFF t1"); |
- |
|
37 |
Serial.println("i = info"); |
- |
|
38 |
Serial.println("R = reset"); |
- |
|
39 |
Serial.println("S = store to EEPROM"); |
35 |
} |
40 |
} |
36 |
|
41 |
|
37 |
int temperature () // Read temperature from Dallas |
42 |
int temperature () // Read temperature from Dallas |
38 |
{ |
43 |
{ |
39 |
int i, temp; |
44 |
int i, temp; |
Line 77... |
Line 82... |
77 |
Serial.print (' '); |
82 |
Serial.print (' '); |
78 |
for (n=1;n<=8;n++) |
83 |
for (n=1;n<=8;n++) |
79 |
{ |
84 |
{ |
80 |
if(digitalRead(n+1)) |
85 |
if(digitalRead(n+1)) |
81 |
{ |
86 |
{ |
82 |
Serial.print('t'); |
87 |
Serial.print((char)('a'+n-1)); |
83 |
} |
88 |
} |
84 |
else |
89 |
else |
85 |
{ |
90 |
{ |
86 |
Serial.print('T'); |
91 |
Serial.print((char)('A'+n-1)); |
- |
|
92 |
} |
- |
|
93 |
} |
- |
|
94 |
Serial.print(' '); |
- |
|
95 |
for (n=1;n<=8;n++) |
- |
|
96 |
{ |
- |
|
97 |
if(EEPROM.read(n)) |
- |
|
98 |
{ |
- |
|
99 |
Serial.print((char)('a'+n-1)); |
- |
|
100 |
} |
- |
|
101 |
else |
- |
|
102 |
{ |
- |
|
103 |
Serial.print((char)('A'+n-1)); |
87 |
} |
104 |
} |
88 |
Serial.print(n, DEC); |
- |
|
89 |
Serial.print(' '); |
- |
|
90 |
} |
105 |
} |
91 |
Serial.println(); |
106 |
Serial.println(); |
92 |
} |
107 |
} |
93 |
|
108 |
|
94 |
|
109 |
|
Line 192... |
Line 207... |
192 |
|
207 |
|
193 |
case 'i': // Print Info |
208 |
case 'i': // Print Info |
194 |
info(); |
209 |
info(); |
195 |
break; |
210 |
break; |
196 |
|
211 |
|
- |
|
212 |
case 'R': // Reset |
- |
|
213 |
asm volatile (" jmp 0"); |
- |
|
214 |
break; |
- |
|
215 |
|
197 |
case 'S': // Save states to EEPROM |
216 |
case 'S': // Save states to EEPROM |
198 |
for (n=1;n<=8;n++) |
217 |
for (n=1;n<=8;n++) |
199 |
{ |
218 |
{ |
200 |
EEPROM.write(n,digitalRead(n+1)); |
219 |
EEPROM.write(n,digitalRead(n+1)); |
201 |
} |
220 |
} |