-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiframe2.html
848 lines (714 loc) · 36.4 KB
/
iframe2.html
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
<html>
<!--
Developer Notes:
common web UI elements (regardless of hardware): hardwareSelect, topToolbar_container, mainUI_container
connectionHelp_container, dependenciesInfoElement
-->
<title> SPIKE iframe </title>
<head>
<!-- <script type="text/javascript" src="./modules/ServiceDock_SPIKEV2.js"></script> -->
<script src="https://cdn.jsdelivr.net/gh/tuftsceeo/[email protected]/cdn/ServiceDock.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"
integrity="sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg=="
crossorigin="anonymous">
</script>
<script language="javascript">
var alreadyInitOnceSPIKE = false; // to prevent event listeners from redefining when hardware reconnects
var motorInfo = '<div id="motor">Motor<div id="motorAngle"></div></div>'
var colorInfo = '<div id="color">Color<div id="colorRGBbox" data-r="0", data-g="0", data-b="0" style="height:18px;width:18px;"> </div> <div id = "colorName" style = "margin-top: 3px; font-size: 12px;"></div> </div>';
var distanceInfo = '<div id="distance">Distance<div id = "distanceValue"></div></div>';
var forceInfo = '<div id="force">Force<div id="forceForce"></div></div>';
// SPIKE Prime Code
var mySPIKE;
var hubProjects;
var devicesInfo = document.getElementById("devicesInfo");
var refreshSlotsDisplayTimeout;
window.onload = function () {
// common web UI elements
var hardwareSelect = document.getElementById("hardwareSelect");
var topToolbar_container = document.getElementById("topToolbar_container");
var mainUI_container = document.getElementById("mainUI_container");
var connectionHelp_container = document.getElementById("connectionHelp_container");
var dependenciesInfoElement = document.getElementById("dependenciesInfo");
// instantiate LEGO hardware Services
mySPIKE = document.getElementById("Service_SPIKE").getService();
handleHardwareSelect();
hardwareSelect.addEventListener("change", async function () {
// TO:DO reinitialize (re"block") hidden UI elements
handleHardwareSelect();
})
/* SPIKE Prime web UI code*/
var refreshButton = document.getElementById("refresh");
refreshButton.addEventListener("click", function () {
document.location.reload();
})
mySPIKE.executeAfterPrint(printOnConsole);
mySPIKE.executeAfterError(printOnConsole);
mySPIKE.executeAfterDisconnect(function () {
mainUI_container.style.display = "none";
connectionHelp_container.style.display = "block";
})
mySPIKE.executeAfterInit(async function () {
mainUI_container.style.display = "block";
connectionHelp_container.style.display = "none";
mySPIKE.getFirmwareInfo(async function (version) {
var hubName = await mySPIKE.getHubName();
var connectInfo = document.getElementById("mainUI_connectInfo");
connectInfo.innerHTML = "<b> Connected to: </b> " + "<em id = 'hubNameElement'>" + hubName + "</em>" + " (Hub OS: " + version + ")";
})
printOnConsole("Successfully connected to SPIKE Prime!");
printOnConsole("Reading registered programs in the hub...");
refreshSlotsDisplay();
// prevent event listeners from defining twice
if (!alreadyInitOnceSPIKE) {
var runButton = document.getElementById("runProgram");
runButton.addEventListener("click", function () {
var slotidSelect = document.getElementById("slotidSelect");
var slotidOption = slotidSelect.options[slotidSelect.selectedIndex];
var slotid = slotidOption.id;
slotid = slotid.substring(4, slotid.length);
var slotidInteger = parseInt(slotid);
printOnConsole("Executing program in position " + slotid + "...")
mySPIKE.executeProgram(slotidInteger);
});
var rebootButton = document.getElementById("rebootHub");
rebootButton.addEventListener("click", function () {
printOnConsole("Rebooting SPIKE Prime Hub...");
mySPIKE.rebootHub();
clearTimeout(refreshSlotsDisplayTimeout);
refreshSlotsDisplayTimeout = setTimeout( function () {
refreshSlotsDisplay();
}, 5000);
});
var stopButton = document.getElementById("stopProgram");
stopButton.addEventListener("click", function () {
printOnConsole("Terminating any running program...");
mySPIKE.stopCurrentProgram();
});
alreadyInitOnceSPIKE = true;
}
mySPIKE.executeWithStream(async function () {
var batteryStatus = await mySPIKE.getBatteryStatus();
var batteryInfo = document.getElementById("batteryInfo");
batteryInfo.innerHTML = "  Battery: " + batteryStatus + "%";
var portsInfo = await mySPIKE.getPortsInfo();
for (var port in portsInfo) {
if (portsInfo[port]["device"] == "smallMotor" || portsInfo[port]["device"] == "bigMotor") {
var motorDiv = await addMotorIcon(port);
var motorAngleDiv = motorDiv.querySelector("#motorAngle");
motorAngleDiv.innerHTML = portsInfo[port]["data"]["uAngle"] + '°';
}
else if (portsInfo[port]["device"] == "color") {
var colorDiv = await addColorIcon(port);
var RGBbox = colorDiv.querySelector("#colorRGBbox");
var R = portsInfo[port]["data"]["RGB"][0];
var G = portsInfo[port]["data"]["RGB"][1];
var B = portsInfo[port]["data"]["RGB"][2];
RGBbox.style.backgroundColor = "rgb(" + R + "," + G + "," + B + ")";
var color = portsInfo[port]["data"]["color"];
var colorNameDiv = colorDiv.querySelector("#colorName");
colorNameDiv.innerHTML = color;
}
else if (portsInfo[port]["device"] == "ultrasonic") {
var distanceDiv = await addDistanceIcon(port);
var distanceValueDiv = distanceDiv.querySelector("#distanceValue");
distanceValueDiv.innerHTML = portsInfo[port]["data"]["distance"] + " cm";
}
else if (portsInfo[port]["device"] == "force") {
var forceDiv = await addForceIcon(port);
var forceForceDiv = forceDiv.querySelector("#forceForce");
forceForceDiv.innerHTML = portsInfo[port]["data"]["force"] + " N";
}
else {
var portDiv = document.getElementById("port" + port + "Info");
var innerDiv = portDiv.getElementsByClassName("morePortInfo");
for (var i = 0; i < innerDiv.length - 1; i++) {
var element = innerDiv[index];
element.style.display = "none";
}
portDiv.style.display = "none";
var deviceInfo = portDiv.querySelector("#deviceInfo");
deviceInfo.innerHTML = "";
}
}
var hubInfo = await mySPIKE.getHubInfo();
var yaw = hubInfo["pos"][0];
var pitch = hubInfo["pos"][1];
var roll = hubInfo["pos"][2];
var yawDiv = document.getElementById("yaw");
var pitchDiv = document.getElementById("pitch");
var rollDiv = document.getElementById("roll");
yawDiv.innerHTML = "yaw: " + yaw;
pitchDiv.innerHTML = "pitch: " + pitch;
rollDiv.innerHTML = "roll: " + roll;
})
printOnConsole("Web UI initialization complete!\n")
/* END OF SPIKE Prime web UI code */
console.log("%cTuftsCEEO ", "color: lightgreen;" ,"iframe window has completed loading");
})
function handleHardwareSelect() {
var hardwareSelected = hardwareSelect.options[hardwareSelect.selectedIndex];
var hardwareSelectedID = hardwareSelected.id;
if (hardwareSelectedID == "hardwareSPIKE") {
if ('serial' in navigator) {
console.log("%cTuftsCEEO ", "color: lightgreen;" ,"serial was detected in the browser");
var documentation = document.getElementById("documentation_SPIKE");
documentation.addEventListener("click", function () {
var url = "./documentation/SPIKE_Prime_Python_Knowledge_Base.htm"
window.open(url);
})
dependenciesInfoElement.style.display = "none";
topToolbar_container.style.display = "block";
if (mySPIKE.isActive()) {
mainUI_container.style.display = "block";
}
else {
connectionHelp_container.style.display = "block";
}
}
else {
console.log("%cTuftsCEEO ", "color: lightgreen;" ,"serial was NOT detected in the browser");
dependenciesInfoElement.style.display = "block";
topToolbar_container.style.display = "none";
mainUI_container.style.display = "none";
}
}
else if (hardwareSelectedID == "replSPIKE") {
window.webExecClient.dispose();
localStorage.setItem("version", 2);
window.location.href = "./build/index.html"
}
else if (hardwareSelectedID == "survey") {
window.open("https://tufts.qualtrics.com/jfe/form/SV_2tM0l0jcPzyPH1z");
hardwareSelect.selectedIndex = 0;
}
}
}; /* end of window.load */
/* helper functions */
function addMotorIcon(port) {
var portInfo = document.getElementById("port" + port + "Info");
portInfo.style.display = "block";
var innerDiv = portInfo.getElementsByClassName("morePortInfo");
for (var i = 0; i < innerDiv.length - 1; i++) {
var element = innerDiv[index];
element.style.display = "block";
}
var deviceInfo = portInfo.querySelector("#deviceInfo");
deviceInfo.innerHTML = "";
deviceInfo.innerHTML = motorInfo;
var motorDiv = portInfo.querySelector("#motor");
return motorDiv;
}
/* SPIKE Prime device icon helper functions */
function addDistanceIcon(port) {
var portInfo = document.getElementById("port" + port + "Info");
portInfo.style.display = "block";
var innerDiv = portInfo.getElementsByClassName("morePortInfo");
for (var i = 0; i < innerDiv.length - 1; i++) {
var element = innerDiv[index];
element.style.display = "block";
}
var deviceInfo = portInfo.querySelector("#deviceInfo");
deviceInfo.innerHTML = "";
deviceInfo.innerHTML = distanceInfo;
var distanceDiv = portInfo.querySelector("#distance");
return distanceDiv;
}
function addColorIcon(port) {
var portInfo = document.getElementById("port" + port + "Info");
portInfo.style.display = "block";
var innerDiv = portInfo.getElementsByClassName("morePortInfo");
for (var i = 0; i < innerDiv.length - 1; i++) {
var element = innerDiv[index];
element.style.display = "block";
}
var deviceInfo = portInfo.querySelector("#deviceInfo");
deviceInfo.innerHTML = "";
deviceInfo.innerHTML = colorInfo;
var colorDiv = portInfo.querySelector("#color");
return colorDiv;
}
function addForceIcon(port) {
var portInfo = document.getElementById("port" + port + "Info");
portInfo.style.display = "block";
var innerDiv = portInfo.getElementsByClassName("morePortInfo");
for (var i = 0; i < innerDiv.length - 1; i++) {
var element = innerDiv[index];
element.style.display = "block";
}
var deviceInfo = portInfo.querySelector("#deviceInfo");
deviceInfo.innerHTML = "";
deviceInfo.innerHTML = forceInfo;
var forceDiv = portInfo.querySelector("#force");
return forceDiv;
}
async function refreshSlotsDisplay(callback) {
var hubProjects = await mySPIKE.getProjects();
for (var slot in hubProjects) {
var slotOption = document.getElementById("slot" + slot);
if (hubProjects[slot] != "None") {
// decode the name
var encodedName = hubProjects[slot]["name"];
var decodedName = atob(encodedName);
slotOption.innerHTML = slot + ": " + decodedName;
}
else {
slotOption.innerHTML = slot + ": " + "Empty";
}
}
if (callback != undefined) {
callback();
}
}
// end of SPIKE code
requirejs.config({
paths: {
'cc-web-exec-client': 'https://unpkg.com/@exlinc/[email protected]/dist/cc-web-exec-sdk'
},
});
requirejs(['cc-web-exec-client'],
function (webExecSDK) {
window.webExecClient = new webExecSDK.CCWebExecClient();
initApp();
}
);
function initApp() {
// NOTE: the subscribe call returns a string id for this subscriber that can be passed to the
// unsubscribe function to drop this particular subscriber. This is not necessary if you call
// the `.dispose()` function or you plan to have your app 'disposed' automatically when the iframe
// is removed by the parent.
window.webExecClient.subscribe('execute_code', function (event, payload) {
console.log("%cTuftsCEEO ", "color: lightgreen;" ,event, payload);
writeCodeExecRequestPayloadToDOM(payload);
});
}
async function writeCodeExecRequestPayloadToDOM(payload) {
var files = payload.files;
var defaultFileName = payload.defaultFileName;
console.log("%cTuftsCEEO ", "color: lightgreen;" ,"defaultFileName: ", defaultFileName);
console.log("%cTuftsCEEO ", "color: lightgreen;" ,"payload: ", payload);
// only gets the content of file with the defaultFileName
for (var key in files) {
console.log("%cTuftsCEEO ", "color: lightgreen;" ,"key: ", key);
var fileName = key;
var fileContent = files[key];
console.log("%cTuftsCEEO ", "color: lightgreen;" ,"fileContent: ", fileContent);
if (fileName == defaultFileName) {
break;
}
}
if (mySPIKE.isActive()) {
// parse the selected slot id
var slotidSelect = document.getElementById("slotidSelect");
var slotidOption = slotidSelect.options[slotidSelect.selectedIndex];
var slotid = slotidOption.id;
slotid = slotid.substring(4, slotid.length);
var slotidInteger = parseInt(slotid);
printOnConsole("Writing new program to position " + slotid + "...");
// var base64encodedFileName = btoa(fileName);
// register the program into SPIKE (only one file can be registered)
mySPIKE.writeProgram(fileName, fileContent, slotidInteger, async function () {
// show the new list of programs currently registered in the SPIKE
printOnConsole("Terminating any running program..." + "");
// stop any currently running program
mySPIKE.stopCurrentProgram();
// refresh programs
refreshSlotsDisplay(function () {
printOnConsole("Executing program in position " + slotidInteger + "..." + "");
// execute the program that was just downloaded
mySPIKE.executeProgram(slotidInteger);
})
});
}
return true;
}
function printOnConsole(message) {
var consoleText = document.getElementById("console");
consoleText.value = consoleText.value + message + "\n";
consoleText.scrollTop = consoleText.scrollHeight
}
</script>
</head>
<body>
<!-- refresh iframe environment-->
<button
style="position: absolute; background:url('./modules/views/freepik_rotation.png')no-repeat; background-size: 35px 35px; background-position: center; background-color: white; border-radius: 18px; height: 40px; width: 40px; cursor: pointer; border:none;"
id="refresh" class="tooltip">
<span class="tooltiptext">Refresh Preview</span>
</button>
<h3 align=center>MicroPython for LEGO® Hardware </h3>
<!-- Select LEGO Hardware -->
<div id="hardwareSelect_container" style="margin-bottom: 10px;" align=center>
Select platform:
<select id="hardwareSelect">
<option id="hardwareSPIKE">SPIKE Prime</option>
<option id="replSPIKE">PyREPL for SPIKE Prime</option>
<option id="survey"><Request new hardware></option>
</select>
</div>
<!-- Information on dependencies for using UI for this specific hardware-->
<div id="dependenciesInfo">
<div style="margin: 10px; font-size: 14px;" class="hardwareIsSPIKE">
To use the SPIKE™ Prime hardware, you must enable the <em><b>WebSerial API</b></em> in your
browser. To do so, please
make sure:
<ol>
<li class="checklist">You are using the
<a id = "googlechromelink" href="https://www.google.com/chrome/" target="_blank">
Google Chrome browser</a>.</li>
<li class="checklist">The following chrome flags are enabled on chrome://flags.</li>
<li class = "steps">Mac OSX user? #enable-experimental-web-platform-features</li>
<li class="steps">Windows user? #enable-experimental-web-platform-features AND #new-usb-backend</li>
</ol>
To enable these flags:
<ol style="font-size: 15px;">
<li class="steps">In your Browser URL, visit
<em>chrome://flags</em></li>
<li class="steps"> Set the your required flags to "Enabled" via dropdown</li>
<li class="steps"> Relaunch the browser to have changes take effect </li>
<li class="steps"> Revisit your Coding Rooms classroom (this website) </li>
</ol>
</div>
</div>
<!-- topToolbar: (Name of hardware, button connecting to hardware, button to documentation for hardware programming-->
<div id="topToolbar_container" align=center>
<div id="topToolbar_SPIKE" class="topToolbar hardwareIsSPIKE">
<div style="position: relative; float:left; margin: 10px; text-align: center; top: 20%;">
Service Dock for SPIKE™ Prime:
</div>
<service-spike id="Service_SPIKE" class="Service tooltip" style = "top: -5px;">
<span class="tooltiptext">Connect to SPIKE Prime</span>
</service-spike>
<button id="documentation_SPIKE" class="documentation tooltip">
<span class="tooltiptext">SPIKE API Documentation</span>
</button>
</div>
</div>
<br />
<!-- connectionHelp: (Instructions on how to connect to hardware) !!! (only active when hardware not connected) -->
<div id="connectionHelp_container" style="margin:auto">
<div>
<div id="SPIKE_connectionHelp" class="connectionHelp hardwareIsSPIKE">
<em style="font-size: 20px;">Connect your SPIKE Prime hardware to your computer (via USB or
Bluetooth) and activate
using the Service Dock functions above</em>
<br />
<br />
<em style="font-size: 16px;">be sure no other applications, programs, or browser windows are
connected to your SPIKE
Prime simultaneously</em>
</div>
</div>
</div>
<!-- mainUI
- topBar
- device Ports (for devices connected to hardware)
- console
-->
<div id="mainUI_container" style="margin: auto;">
<div id="mainUI_SPIKE" class="mainUI">
<div id="topbar">
<div align=center style="margin-top: 10px;">
<div id="mainUI_connectInfo" style="margin: 10px; display: table-cell;">
</div>
<div id="batteryInfo" style="display: table-cell">
</div>
</div>
<div id="mainUI_toolbar" align=center style="margin: 10px;">
<div style="display: table-cell; top: 5px; position: relative;">
Select Storage Position:
<select id="slotidSelect" style=" width: 150px; align-items: center; margin-right: 10px;"
class="hardwareIsSPIKE">
<option value = "slot0" id="slot0">0</option>
<option value = "slot1" id="slot1">1</option>
<option value = "slot2" id="slot2">2</option>
<option value = "slot3" id="slot3">3</option>
<option value = "slot4" id="slot4">4</option>
<option value = "slot5" id="slot5">5</option>
<option value = "slot6" id="slot6">6</option>
<option value = "slot7" id="slot7">7</option>
<option value = "slot8" id="slot8">8</option>
<option value = "slot9" id="slot9">9</option>
<option value = "slot10" id="slot10">10</option>
<option value = "slot11" id="slot11">11</option>
<option value = "slot12" id="slot12">12</option>
<option value = "slot13" id="slot13">13</option>
<option value = "slot14" id="slot14">14</option>
<option value = "slot15" id="slot15">15</option>
<option value = "slot16" id="slot16">16</option>
<option value = "slot17" id="slot17">17</option>
<option value = "slot18" id="slot18">18</option>
<option value = "slot19" id="slot19">19</option>
</select>
</div>
<div style="display: table-cell; margin: 5px;">
<button id="runProgram"
style="background: url(./modules/views/Run_Button.png) no-repeat; background-position: center; background-size: 56px 30px; height: 32px; width: 47px; border-radius: 47px; display: table-cell;"
class="tooltip mainUI_button">
<span class="tooltiptext">Play Program</span>
</button>
<button id="stopProgram"
style="background: url(./modules/views/Stop_Button.png) no-repeat; background-position: center; background-size: 56px 30px; height: 32px; width: 47px; border-radius: 47px; display: table-cell;"
class="tooltip mainUI_button">
<span class="tooltiptext">Stop Program</span>
</button>
<button id="rebootHub"
style="background: url(./modules/views/Reboot_1.png) no-repeat; background-position: -7px 0px; background-size: 56px 30px; height: 32px; width: 47px; border-radius: 47px; display: table-cell;"
class="tooltip mainUI_button">
<span class="tooltiptext">Reboot SPIKE Prime</span>
</button>
</div>
</div>
</div>
<div id="mainUI_devicePorts" style="margin: 10px;" align=center>
<div id="devicesInfo" align=center>
<div id="hubInfo" class="SPIKE_devicePort">
<div id="deviceInfo">
<div id="yaw">yaw:</div>
<div id="pitch">pitch:</div>
<div id="roll">roll:</div>
</div>
<div class="morePortInfo">
Hub
</div>
</div>
<div id="portAInfo" class="SPIKE_devicePort">
<div id="deviceInfo">
</div>
<div class="morePortInfo">
Port A
</div>
</div>
<div id="portBInfo" class="SPIKE_devicePort">
<div id="deviceInfo">
</div>
<div class="morePortInfo">
Port B
</div>
</div>
<div id="portCInfo" class="SPIKE_devicePort">
<div id="deviceInfo">
</div>
<div class="morePortInfo">
Port C
</div>
</div>
<div id="portDInfo" class="SPIKE_devicePort">
<div id="deviceInfo">
</div>
<div class="morePortInfo">
Port D
</div>
</div>
<div id="portEInfo" class="SPIKE_devicePort">
<div id="deviceInfo">
</div>
<div class="morePortInfo">
Port E
</div>
</div>
<div id="portFInfo" class="SPIKE_devicePort">
<div id="deviceInfo">
</div>
<div class="morePortInfo">
Port F
</div>
</div>
</div>
</div>
<div id="mainUI_console" style="margin: 10px;">
<div id="telemetry" align=center>
<div>Console</div>
<textarea id="console" readonly></textarea>
</div>
</div>
</div>
</div>
<div id="disclaimer" align=center style="margin: 10px;">
<h5>
CodingRooms’ implementation of “MicroPython for LEGO® Hardware” created in collaboration with
researchers at Tufts Center for Engineering Education and Outreach (CEEO). To see other CEEO Innovation projects, visit
<a id = "ceeoinnovationslink" href="http://www.CEEOInnovations.org" target="_blank">
CEEOInnovations.org.
</a>
</h5>
<h5>
LEGO®, the LEGO® logo, the Brick, MINDSTORMS®, SPIKE™, and the Minifigure are trademarks of ©The LEGO®
Group.
All other
trademarks and copyrights are the property of their respective owners. All rights reserved. CodingRooms
isn’t affiliated, authorized, or endorsed by The LEGO Group.
</h5>
<h5>
The "refresh preview" icon is attributed to Freepik. The "API" icon is attributed to icons8. All other icons are attributed to Tufts CEEO.
</h5>
</div>
</body>
<style>
body {
background-color: rgb(7, 23, 44);
color: rgb(243, 250, 254);
font-family: Verdana, Geneva, sans-serif;
}
a:visited, a {
text-decoration: none;
color: white;
}
#googlechromelink {
color: rgb(7, 23, 44);
}
/* common web UI elements */
#mainUI_container,
#topToolbar_container,
#connectionHelp_container {
display: none;
}
#dependenciesInfo {
background-color: rgb(243, 250, 254);
color: rgb(7, 23, 44);
border: solid;
border-width: 1px;
margin: 10px;
display:none;
}
#dependenciesInfo .checklist {
line-height: 150%;
font-family: Verdana, Geneva, Tahoma, sans-serif;
text-indent: 1em;
}
#dependenciesInfo .steps {
font-size: 13px;
line-height: 180%;
font-family: Verdana, Geneva, Tahoma, sans-serif;
list-style-type: "-";
text-indent: 1em;
}
.topToolbar {
background-color: rgb(243, 250, 254);
color: rgb(7, 23, 44);
position: relative;
width: 500px;
height: 70px;
border: solid;
border-width: 1px;
margin: auto;
display: inline-block;
}
.connectionHelp {
background-color: rgb(243, 250, 254);
color: rgb(7, 23, 44);
border: solid;
border-width: 1px;
margin: 10px;
padding: 10px;
}
.mainUI {
background-color: rgb(243, 250, 254);
color: rgb(7, 23, 44);
border: solid;
border-width: 1px;
}
.documentation {
height: 50px;
width: 50px;
position: relative;
float: left;
border-radius: 10px;
background-color: yellowgreen;
top: 10px;
cursor: pointer;
background: url("./modules/views/icons8_api.png");
background-color: rgb(240, 182, 82);
background-size: 75px 87px;
border: none;
background-position: center;
}
.Service {
position: relative;
float: left;
margin: 0px 10px 10px 0px;
}
.Service:focus,
.documentation:focus,
.tooltip:focus {
outline: 0;
}
/* SPIKE Prime web UI elements */
#runProgram,
#rebootHub,
#stopProgram {
cursor: pointer;
background-color: orange;
}
#devicesInfo {
position: relative;
display: flex;
flex-wrap: wrap;
/* for horizontal aligning of child divs */
justify-content: center;
/* for vertical aligning */
align-items: center;
font-size: 14px;
}
#hubInfo {
background-color: orange;
width: 65px;
height: 73px;
margin: 3px;
font-size: 12px;
}
.SPIKE_devicePort {
background-color: lightblue;
width: 65px;
height: 73px;
margin: 3px;
border-radius: 5px;
position: relative;
}
.morePortInfo {
position: absolute;
top: 55px;
margin: auto;
font-size: 15px;
text-indent: 2px;
}
#console {
width: 500px;
height: 150px;
white-space: pre-wrap;
background-color: rgb(43, 43, 43);
color: rgb(105, 255, 120);
font-family: Verdana, Geneva, sans-serif;
}
/* toolTip CSS from w3schools */
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
width: 190%;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text */
position: absolute;
top: 30px;
z-index: 1;
left: 10%;
/* Fade in tooltip */
opacity: 0;
transition: opacity 0.3s;
transition-delay: 0.5s;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
</style>
</html>