Skip to content

Commit 3f1cabc

Browse files
committed
Make status bar smaller and change text depending on status
1 parent 9c416ce commit 3f1cabc

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
# Arduino remote switch
2-
Remote switch to turn on PC.
1+
# Arduino Remote Switch
2+
3+
Remote switch to turn on, off or reset PC.
34

45
![Web interface](./web.png)
56

67
## Getting started
78

89
### Hardware
10+
911
- Arduino Uno
1012
- Arduino Ethernet Shield
1113
- Ethernet cable
1214
- Micro SD card
13-
- Wires
14-
// TODO how many wires?
15+
- Wires
16+
// TODO how many wires?
1517

1618
### Software
19+
1720
- Arduino IDE
1821

1922
### Steps
2023

2124
> **Disclaimer:** Follow these instruction at your own risk.
2225
2326
1. Format SD card to FAT16.
24-
2. Store website (content of `web/src/`) on SD card.
27+
2. Store website (content of `web/src/`) on SD card.
2528
3. Put SD card into ethernet shield.
26-
5. Upload server program `server.ino` to Arduino via Arduino IDE.
27-
6. Turn off Arduino and PC and detach from power.
28-
7. Wire cables between your PC and Arduino like following:
29-
TODO Picture wiring of schematic
30-
29+
4. Upload server program `server.ino` to Arduino via Arduino IDE.
30+
5. Turn off Arduino and PC and detach from power.
31+
6. Wire cables between your PC and Arduino like following:
32+
TODO Picture wiring of schematic

web.png

-773 Bytes
Loading

web/src/index.htm

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<div class="heading">STORINATOR</div>
1111

1212
<button
13-
id="powerLed"
13+
id="powerStatus"
1414
type="button"
1515
class="button"
1616
disabled
17-
style="color: #b413ff"
17+
style="height: 5%; font-size: 2vh; color: #b413ff"
1818
>
1919
NO CONNECTION
2020
</button>
@@ -122,17 +122,17 @@
122122
requestStatus(REQ_POWER_STATUS)
123123
}, 3000)
124124

125-
function togglePowerLedColor(state) {
126-
const powerLed = document.getElementById('powerLed')
125+
function togglePowerStatus(state) {
126+
const powerStatus = document.getElementById('powerStatus')
127127
if (state == 'on') {
128-
powerLed.textContent = 'POWER LED'
129-
powerLed.style.color = '#27e670'
128+
powerStatus.textContent = 'POWERED ON'
129+
powerStatus.style.color = '#27e670'
130130
} else if (state == 'off') {
131-
powerLed.textContent = 'POWER LED'
132-
powerLed.style.color = '#eb1e8f'
131+
powerStatus.textContent = 'POWERED OFF'
132+
powerStatus.style.color = '#eb1e8f'
133133
} else {
134-
powerLed.style.color = '#b413ff'
135-
powerLed.textContent = 'NO CONNECTION'
134+
powerStatus.style.color = '#b413ff'
135+
powerStatus.textContent = 'NO CONNECTION'
136136
}
137137
}
138138

@@ -160,16 +160,16 @@
160160
typeof this.response === 'string'
161161
) {
162162
if (this.response.toString().includes(REQ_POWER_STATUS + ':on'))
163-
togglePowerLedColor('on')
164-
else togglePowerLedColor('off')
163+
togglePowerStatus('on')
164+
else togglePowerStatus('off')
165165
} else if (this.readyState == 4) {
166-
togglePowerLedColor('nocon')
166+
togglePowerStatus('nocon')
167167
console.log('No connection to server.')
168168
}
169169
}
170170
}
171171
xhttp.onerror = function () {
172-
togglePowerLedColor('nocon')
172+
togglePowerStatus('nocon')
173173
console.log('No connection to server.')
174174
}
175175
xhttp.open('GET', request, true)

0 commit comments

Comments
 (0)