|
511 | 511 |
|
512 | 512 | snack('Device ' + device.name + ' has been disconnected.', 1);
|
513 | 513 | 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); |
514 | 518 | }
|
515 | 519 |
|
516 | 520 | function BLEwriteTo(sensor) {
|
|
530 | 534 | <script>
|
531 | 535 |
|
532 | 536 | 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 | + |
533 | 544 | NiclaSenseME.led.colorPicker = new iro.ColorPicker("#color-picker-container", {
|
534 | 545 | width: 150,
|
535 |
| - color: "rgb(255, 0, 0)", |
| 546 | + color: "rgb(0, 0, 255)", |
536 | 547 | borderWidth: 1,
|
537 | 548 | borderColor: "#fff",
|
538 | 549 | sliderHeight: 6,
|
|
547 | 558 | NiclaSenseME['led'].writeValue = rgb_values;
|
548 | 559 | BLEwriteTo('led');
|
549 | 560 | }
|
| 561 | + |
| 562 | + |
550 | 563 | }
|
551 | 564 |
|
552 | 565 | // Graphing
|
|
613 | 626 | var geometry = new THREE.BoxGeometry(1, 1, 1);
|
614 | 627 | ledMaterial = new THREE.MeshBasicMaterial({ color: 0x111111 });
|
615 | 628 | 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 | + |
618 | 637 | 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); |
622 | 638 | arduinoModel.add(ledLight);
|
| 639 | + |
| 640 | + arduinoModel.rotation.x = 90 * (Math.PI/180); // Show the bottom side of the board by default |
| 641 | + |
623 | 642 | var sphereSize = 1;
|
624 | 643 |
|
625 | 644 | // Light
|
626 | 645 | const color = 0xFFFFFF;
|
627 | 646 | const intensity = 1;
|
628 | 647 | const light = new THREE.DirectionalLight(color, intensity);
|
629 |
| - light.position.set(0, 0, -50); |
| 648 | + light.position.set(-20, 100, -10); |
630 | 649 | light.target.position.set(0, 0, 0);
|
631 | 650 | scene.add(light);
|
632 | 651 | scene.add(light.target);
|
|
0 commit comments