-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmobile.html
More file actions
53 lines (47 loc) · 2.33 KB
/
Copy pathmobile.html
File metadata and controls
53 lines (47 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>CERN Remote Control</title>
<style>
body { background: #0b0e14; color: #00ff41; font-family: monospace; text-align: center; padding: 20px; }
.coil-box { border: 2px solid #00ff41; padding: 20px; margin-top: 30px; border-radius: 10px; background: #161b22; }
input[type="range"] { width: 100%; height: 40px; margin-top: 20px; accent-color: #00ff41; }
</style>
</head>
<body>
<h1>CERN AD-HALL<br>OVERRIDE</h1>
<div class="coil-box">
<div>YOUR ASSIGNED COIL:</div>
<div id="assignedCoil" style="font-size: 24px; color: #ff3131; font-weight: bold; margin: 10px 0;">LOADING...</div>
<div>POWER OUTPUT: <span id="valDisplay">0.0</span>A</div>
<input type="range" id="powerSlider" min="0" max="200" step="0.1" value="0">
</div>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.8.1/firebase-app.js";
import { getDatabase, ref, set } from "https://www.gstatic.com/firebasejs/10.8.1/firebase-database.js";
// 2. PASTE YOUR FIREBASE CONFIG HERE
const firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "YOUR_PROJECT.firebaseapp.com",
databaseURL: "https://YOUR_PROJECT.firebaseio.com",
projectId: "YOUR_PROJECT"
};
const app = initializeApp(firebaseConfig);
const db = getDatabase(app);
// 3. Generate a random user ID and assign a coil (1 to 10)
const userId = "user_" + Math.random().toString(36).substr(2, 9);
const coilNumber = Math.floor(Math.random() * 10) + 1;
const myCoil = `Coil ${coilNumber}`;
document.getElementById('assignedCoil').innerText = myCoil.toUpperCase();
// 4. Send data to the cloud when sliding
const slider = document.getElementById('powerSlider');
slider.addEventListener('input', function() {
document.getElementById('valDisplay').innerText = this.value;
// Write to: database -> coils -> Coil X -> user_ID -> value
set(ref(db, 'coils/' + myCoil + '/' + userId), parseFloat(this.value));
});
</script>
</body>
</html>