Skip to content

Commit 2ea57d6

Browse files
committed
Align LED color with all the states
1 parent 765290a commit 2ea57d6

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

NiclaSenseME-dashboard/index.html

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,10 @@
511511

512512
snack('Device ' + device.name + ' has been disconnected.', 1);
513513
msg("Disconnected");
514+
515+
// The board's LED will go red once it detects it has been disconnected
516+
ledLight.color.setRGB(255,0,0);
517+
ledMaterial.color.setRGB(255,0,0);
514518
}
515519

516520
function BLEwriteTo(sensor) {
@@ -530,9 +534,16 @@
530534
<script>
531535

532536
function initColorPicker() {
537+
//Default color blue
538+
var rgb_values = Uint8Array.of(0, 0, 255);
539+
NiclaSenseME['led'].writeValue = rgb_values;
540+
BLEwriteTo('led');
541+
ledMaterial.color.setRGB(0,0,255);
542+
ledLight.color.setRGB(0,0,255);
543+
533544
NiclaSenseME.led.colorPicker = new iro.ColorPicker("#color-picker-container", {
534545
width: 150,
535-
color: "rgb(255, 0, 0)",
546+
color: "rgb(0, 0, 255)",
536547
borderWidth: 1,
537548
borderColor: "#fff",
538549
sliderHeight: 6,
@@ -547,6 +558,8 @@
547558
NiclaSenseME['led'].writeValue = rgb_values;
548559
BLEwriteTo('led');
549560
}
561+
562+
550563
}
551564

552565
// Graphing
@@ -613,20 +626,26 @@
613626
var geometry = new THREE.BoxGeometry(1, 1, 1);
614627
ledMaterial = new THREE.MeshBasicMaterial({ color: 0x111111 });
615628
ledObject = new THREE.Mesh(geometry, ledMaterial);
616-
// ledObject.position.set(-4.5, 4, 0);
617-
ledObject.position.set(9, -10, 0);
629+
ledObject.position.set(9, -10, -1);
630+
631+
ledLight = new THREE.PointLight(0x111111, 3, 40);
632+
ledLight.color.setRGB(0,255,0);
633+
ledLight.position.set(9, -10, -1.2);
634+
635+
ledMaterial.color.setRGB(0,255,0);
636+
618637
arduinoModel.add(ledObject);
619-
arduinoModel.rotation.x = 270 * (Math.PI/180); // Show the bottom side of the board by default
620-
ledLight = new THREE.PointLight(0x111111, 3, 100);
621-
ledLight.position.set(8.7, -10, -5);
622638
arduinoModel.add(ledLight);
639+
640+
arduinoModel.rotation.x = 90 * (Math.PI/180); // Show the bottom side of the board by default
641+
623642
var sphereSize = 1;
624643

625644
// Light
626645
const color = 0xFFFFFF;
627646
const intensity = 1;
628647
const light = new THREE.DirectionalLight(color, intensity);
629-
light.position.set(0, 0, -50);
648+
light.position.set(-20, 100, -10);
630649
light.target.position.set(0, 0, 0);
631650
scene.add(light);
632651
scene.add(light.target);

0 commit comments

Comments
 (0)