HoloLens와 ESPr® Developer에서 L 치카
굉장히 호화로운 L 치카가되어 있습니다 w

필요한 것
Microsoft HoloLens ¥333,800
ESPr® Developer(핀 소켓 장착) ¥2,580
미니 브레드 보드 ¥130
점퍼 와이어 (수컷-수컷) ¥492
LED ¥82
합계: ¥337,084
거의 HoloLens 요금. . .
개발 환경
이번 이용한 것은 Milkcocoa 라는 BaaS 서비스입니다.
IoT 디바이스, 스마트 폰, PC간에 실시간 데이터 교환이 간단
할 수 있게 되는 클라우드 플랫폼입니다.
1일의 이용 제한은 있습니다만, 기본 무료로 이용할 수 있습니다.
Milkcocoa 등록
여기를 방문하십시오 (https://mlkcca.com/)무료 등록을 실시합니다

무료 등록 완료 후 새로운 앱을 만듭니다.
이름은 이번 HoloESPr
로 했습니다.


대시보드에 있는 app_id
를 적어 둡시다.

Unity 설정
HoloLens의 자세한 설정은 생략합니다.HoloLensCamera
와 InputManager
, CursorWithFeedback
를 히에라루키뷰에 설치합니다.
이번에 스위치를 설치하고 싶기 때문에 무료 Assets을 사용했습니다.
htps //w w. 어쨌든 ts. 글쎄, ty3d. 이 m/jp/#! /콘텐 t/38257

새 스크립트 작성
스크립트를 새로 만듭니다.
이번에는 TestScripts.cs
를 만들었습니다.
TestScripts.csusing HoloToolkit.Unity.InputModule;
using UnityEngine;
public class TestScripts : MonoBehaviour, IInputClickHandler
{
#if UNITY_UWP
private Milkcocoa.Milkcocoa Milkcocoa;
#endif
bool switchFlg = false;
// Use this for initialization
void Start () {
Debug.Log("Start");
#if UNITY_UWP
Milkcocoa = new Milkcocoa.Milkcocoa("XXXXXXXXXXXXXXX.mlkcca.com"); // メモしたapp_idを入力します
Milkcocoa.dataStore("message").push(new { v = 0 });
#endif
}
// Update is called once per frame
void Update () {
}
public void OnInputClicked(InputClickedEventData eventData)
{
Debug.Log("OnInputClicked");
switchFlg = !switchFlg;
#if UNITY_UWP
// クリック時にpush
if (switchFlg) {
Milkcocoa.dataStore("message").push(new { v = 1 });
} else {
Milkcocoa.dataStore("message").push(new { v = 0 });
}
#endif
}
}
만든 스크립트를 Switch에 연결합니다.

HoloLens 설정
PlayerSetting은 .NET4.6
를 선택합니다.

Internet 권위를 붙이는 것을 잊어서, 처음에 전혀 잘 가지 않았다. . .

UWP Build Type을 D3D
로 설정하고 Unity C# Projects에 체크를 하여 Bluild합시다.

Visual Studio에서 Milkcocoa 설치
build 하고 할 수 있었던 .slnファイル
를 기동합시다.
도구 - NuGet 패키지 관리자 - 패키지 관리자 콘솔을 클릭합니다.

Install-Package Milkcocoa
를 입력합니다.

설치가 올바른지 확인합니다.

HoloLens 시작
지금까지 가능하면 시작합시다.
On 버튼을 클릭하면 Milkcocoa에 기록됩니다.

Milkcocoa 대시보드에서 확인합니다.

Arduino 설정
다음은 Arduino를 설정합니다.
여기에서 SDK를 다운로드합시다.
다운로드한 zip을 Arduino에 설치합니다.

구체적인 코드 샘플은 다음과 같습니다.
#include <Milkcocoa.h>
#include <ESP8266WiFi.h>
/************************* Your Milkcocoa Setup *********************************/
#define MILKCOCOA_APP_ID "xxxxxxxxxxxxx"
#define MILKCOCOA_DATASTORE "message"
/************* Milkcocoa Setup (you don't need to change this!) ******************/
#define MILKCOCOA_SERVERPORT 1883
//ご自分のルーターのSSIDを入力してください
const char* ssid = "XXXXXXX";
//ご自分のルーターのパスワード
const char* password = "XXXXXXXXXX";
// 使用するLEDのPin番号
int LedPin = 14;
// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;
const char MQTT_SERVER[] PROGMEM = MILKCOCOA_APP_ID ".mlkcca.com";
const char MQTT_CLIENTID[] PROGMEM = __TIME__ MILKCOCOA_APP_ID;
// Milkcocoa設定
Milkcocoa milkcocoa = Milkcocoa(&client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MILKCOCOA_APP_ID, MQTT_CLIENTID);
void onpush(DataElement *elem) {
Serial.println("onpush");
Serial.println(elem->getInt("v"));
if (elem->getInt("v") == 1) {
Serial.println("disp=1");
// LED点灯
digitalWrite(LedPin, HIGH);
} else {
Serial.println("disp=0");
// LED消灯
digitalWrite(LedPin, LOW);
}
};
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// connect to wifi.
WiFi.begin(ssid, password);
WiFi.mode(WIFI_STA); // omajinai
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(10000);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
// LED設定
pinMode(LedPin, OUTPUT);
// Milkcocoa初期化
Serial.println( milkcocoa.on(MILKCOCOA_DATASTORE, "push", onpush) );
}
void loop() {
// ↓ 必ず必要
milkcocoa.loop();
delay(1000);
}
이제 마이크로 컴퓨터 보드에 씁니다.
HoloLens를 시작하고 ESPrDeveloper도 시작합니다.
그러면 L치카가 잘 될 것입니다.

요약
매우 간단하게 HoloLens와 제휴가 가능했습니다.
응용하면 실제 라이트 등에 3D 오브젝트를 배치하여 HoloLens 위에서 라이트의 밝기를 조정하는 것도 가능한가 생각합니다.
그럼 멋진 HoloLens 생활을!
Reference
이 문제에 관하여(HoloLens와 ESPr® Developer에서 L 치카), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/h-takauma/items/a96582700b26d3d43d28
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
HoloLens의 자세한 설정은 생략합니다.
HoloLensCamera
와 InputManager
, CursorWithFeedback
를 히에라루키뷰에 설치합니다.이번에 스위치를 설치하고 싶기 때문에 무료 Assets을 사용했습니다.
htps //w w. 어쨌든 ts. 글쎄, ty3d. 이 m/jp/#! /콘텐 t/38257

새 스크립트 작성
스크립트를 새로 만듭니다.
이번에는 TestScripts.cs
를 만들었습니다.
TestScripts.csusing HoloToolkit.Unity.InputModule;
using UnityEngine;
public class TestScripts : MonoBehaviour, IInputClickHandler
{
#if UNITY_UWP
private Milkcocoa.Milkcocoa Milkcocoa;
#endif
bool switchFlg = false;
// Use this for initialization
void Start () {
Debug.Log("Start");
#if UNITY_UWP
Milkcocoa = new Milkcocoa.Milkcocoa("XXXXXXXXXXXXXXX.mlkcca.com"); // メモしたapp_idを入力します
Milkcocoa.dataStore("message").push(new { v = 0 });
#endif
}
// Update is called once per frame
void Update () {
}
public void OnInputClicked(InputClickedEventData eventData)
{
Debug.Log("OnInputClicked");
switchFlg = !switchFlg;
#if UNITY_UWP
// クリック時にpush
if (switchFlg) {
Milkcocoa.dataStore("message").push(new { v = 1 });
} else {
Milkcocoa.dataStore("message").push(new { v = 0 });
}
#endif
}
}
만든 스크립트를 Switch에 연결합니다.

HoloLens 설정
PlayerSetting은 .NET4.6
를 선택합니다.

Internet 권위를 붙이는 것을 잊어서, 처음에 전혀 잘 가지 않았다. . .

UWP Build Type을 D3D
로 설정하고 Unity C# Projects에 체크를 하여 Bluild합시다.

Visual Studio에서 Milkcocoa 설치
build 하고 할 수 있었던 .slnファイル
를 기동합시다.
도구 - NuGet 패키지 관리자 - 패키지 관리자 콘솔을 클릭합니다.

Install-Package Milkcocoa
를 입력합니다.

설치가 올바른지 확인합니다.

HoloLens 시작
지금까지 가능하면 시작합시다.
On 버튼을 클릭하면 Milkcocoa에 기록됩니다.

Milkcocoa 대시보드에서 확인합니다.

Arduino 설정
다음은 Arduino를 설정합니다.
여기에서 SDK를 다운로드합시다.
다운로드한 zip을 Arduino에 설치합니다.

구체적인 코드 샘플은 다음과 같습니다.
#include <Milkcocoa.h>
#include <ESP8266WiFi.h>
/************************* Your Milkcocoa Setup *********************************/
#define MILKCOCOA_APP_ID "xxxxxxxxxxxxx"
#define MILKCOCOA_DATASTORE "message"
/************* Milkcocoa Setup (you don't need to change this!) ******************/
#define MILKCOCOA_SERVERPORT 1883
//ご自分のルーターのSSIDを入力してください
const char* ssid = "XXXXXXX";
//ご自分のルーターのパスワード
const char* password = "XXXXXXXXXX";
// 使用するLEDのPin番号
int LedPin = 14;
// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;
const char MQTT_SERVER[] PROGMEM = MILKCOCOA_APP_ID ".mlkcca.com";
const char MQTT_CLIENTID[] PROGMEM = __TIME__ MILKCOCOA_APP_ID;
// Milkcocoa設定
Milkcocoa milkcocoa = Milkcocoa(&client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MILKCOCOA_APP_ID, MQTT_CLIENTID);
void onpush(DataElement *elem) {
Serial.println("onpush");
Serial.println(elem->getInt("v"));
if (elem->getInt("v") == 1) {
Serial.println("disp=1");
// LED点灯
digitalWrite(LedPin, HIGH);
} else {
Serial.println("disp=0");
// LED消灯
digitalWrite(LedPin, LOW);
}
};
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// connect to wifi.
WiFi.begin(ssid, password);
WiFi.mode(WIFI_STA); // omajinai
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(10000);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
// LED設定
pinMode(LedPin, OUTPUT);
// Milkcocoa初期化
Serial.println( milkcocoa.on(MILKCOCOA_DATASTORE, "push", onpush) );
}
void loop() {
// ↓ 必ず必要
milkcocoa.loop();
delay(1000);
}
이제 마이크로 컴퓨터 보드에 씁니다.
HoloLens를 시작하고 ESPrDeveloper도 시작합니다.
그러면 L치카가 잘 될 것입니다.

요약
매우 간단하게 HoloLens와 제휴가 가능했습니다.
응용하면 실제 라이트 등에 3D 오브젝트를 배치하여 HoloLens 위에서 라이트의 밝기를 조정하는 것도 가능한가 생각합니다.
그럼 멋진 HoloLens 생활을!
Reference
이 문제에 관하여(HoloLens와 ESPr® Developer에서 L 치카), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/h-takauma/items/a96582700b26d3d43d28
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
using HoloToolkit.Unity.InputModule;
using UnityEngine;
public class TestScripts : MonoBehaviour, IInputClickHandler
{
#if UNITY_UWP
private Milkcocoa.Milkcocoa Milkcocoa;
#endif
bool switchFlg = false;
// Use this for initialization
void Start () {
Debug.Log("Start");
#if UNITY_UWP
Milkcocoa = new Milkcocoa.Milkcocoa("XXXXXXXXXXXXXXX.mlkcca.com"); // メモしたapp_idを入力します
Milkcocoa.dataStore("message").push(new { v = 0 });
#endif
}
// Update is called once per frame
void Update () {
}
public void OnInputClicked(InputClickedEventData eventData)
{
Debug.Log("OnInputClicked");
switchFlg = !switchFlg;
#if UNITY_UWP
// クリック時にpush
if (switchFlg) {
Milkcocoa.dataStore("message").push(new { v = 1 });
} else {
Milkcocoa.dataStore("message").push(new { v = 0 });
}
#endif
}
}
PlayerSetting은
.NET4.6
를 선택합니다.
Internet 권위를 붙이는 것을 잊어서, 처음에 전혀 잘 가지 않았다. . .

UWP Build Type을
D3D
로 설정하고 Unity C# Projects에 체크를 하여 Bluild합시다.
Visual Studio에서 Milkcocoa 설치
build 하고 할 수 있었던 .slnファイル
를 기동합시다.
도구 - NuGet 패키지 관리자 - 패키지 관리자 콘솔을 클릭합니다.

Install-Package Milkcocoa
를 입력합니다.

설치가 올바른지 확인합니다.

HoloLens 시작
지금까지 가능하면 시작합시다.
On 버튼을 클릭하면 Milkcocoa에 기록됩니다.

Milkcocoa 대시보드에서 확인합니다.

Arduino 설정
다음은 Arduino를 설정합니다.
여기에서 SDK를 다운로드합시다.
다운로드한 zip을 Arduino에 설치합니다.

구체적인 코드 샘플은 다음과 같습니다.
#include <Milkcocoa.h>
#include <ESP8266WiFi.h>
/************************* Your Milkcocoa Setup *********************************/
#define MILKCOCOA_APP_ID "xxxxxxxxxxxxx"
#define MILKCOCOA_DATASTORE "message"
/************* Milkcocoa Setup (you don't need to change this!) ******************/
#define MILKCOCOA_SERVERPORT 1883
//ご自分のルーターのSSIDを入力してください
const char* ssid = "XXXXXXX";
//ご自分のルーターのパスワード
const char* password = "XXXXXXXXXX";
// 使用するLEDのPin番号
int LedPin = 14;
// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;
const char MQTT_SERVER[] PROGMEM = MILKCOCOA_APP_ID ".mlkcca.com";
const char MQTT_CLIENTID[] PROGMEM = __TIME__ MILKCOCOA_APP_ID;
// Milkcocoa設定
Milkcocoa milkcocoa = Milkcocoa(&client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MILKCOCOA_APP_ID, MQTT_CLIENTID);
void onpush(DataElement *elem) {
Serial.println("onpush");
Serial.println(elem->getInt("v"));
if (elem->getInt("v") == 1) {
Serial.println("disp=1");
// LED点灯
digitalWrite(LedPin, HIGH);
} else {
Serial.println("disp=0");
// LED消灯
digitalWrite(LedPin, LOW);
}
};
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// connect to wifi.
WiFi.begin(ssid, password);
WiFi.mode(WIFI_STA); // omajinai
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(10000);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
// LED設定
pinMode(LedPin, OUTPUT);
// Milkcocoa初期化
Serial.println( milkcocoa.on(MILKCOCOA_DATASTORE, "push", onpush) );
}
void loop() {
// ↓ 必ず必要
milkcocoa.loop();
delay(1000);
}
이제 마이크로 컴퓨터 보드에 씁니다.
HoloLens를 시작하고 ESPrDeveloper도 시작합니다.
그러면 L치카가 잘 될 것입니다.

요약
매우 간단하게 HoloLens와 제휴가 가능했습니다.
응용하면 실제 라이트 등에 3D 오브젝트를 배치하여 HoloLens 위에서 라이트의 밝기를 조정하는 것도 가능한가 생각합니다.
그럼 멋진 HoloLens 생활을!
Reference
이 문제에 관하여(HoloLens와 ESPr® Developer에서 L 치카), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/h-takauma/items/a96582700b26d3d43d28
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
지금까지 가능하면 시작합시다.
On 버튼을 클릭하면 Milkcocoa에 기록됩니다.

Milkcocoa 대시보드에서 확인합니다.

Arduino 설정
다음은 Arduino를 설정합니다.
여기에서 SDK를 다운로드합시다.
다운로드한 zip을 Arduino에 설치합니다.

구체적인 코드 샘플은 다음과 같습니다.
#include <Milkcocoa.h>
#include <ESP8266WiFi.h>
/************************* Your Milkcocoa Setup *********************************/
#define MILKCOCOA_APP_ID "xxxxxxxxxxxxx"
#define MILKCOCOA_DATASTORE "message"
/************* Milkcocoa Setup (you don't need to change this!) ******************/
#define MILKCOCOA_SERVERPORT 1883
//ご自分のルーターのSSIDを入力してください
const char* ssid = "XXXXXXX";
//ご自分のルーターのパスワード
const char* password = "XXXXXXXXXX";
// 使用するLEDのPin番号
int LedPin = 14;
// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;
const char MQTT_SERVER[] PROGMEM = MILKCOCOA_APP_ID ".mlkcca.com";
const char MQTT_CLIENTID[] PROGMEM = __TIME__ MILKCOCOA_APP_ID;
// Milkcocoa設定
Milkcocoa milkcocoa = Milkcocoa(&client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MILKCOCOA_APP_ID, MQTT_CLIENTID);
void onpush(DataElement *elem) {
Serial.println("onpush");
Serial.println(elem->getInt("v"));
if (elem->getInt("v") == 1) {
Serial.println("disp=1");
// LED点灯
digitalWrite(LedPin, HIGH);
} else {
Serial.println("disp=0");
// LED消灯
digitalWrite(LedPin, LOW);
}
};
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// connect to wifi.
WiFi.begin(ssid, password);
WiFi.mode(WIFI_STA); // omajinai
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(10000);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
// LED設定
pinMode(LedPin, OUTPUT);
// Milkcocoa初期化
Serial.println( milkcocoa.on(MILKCOCOA_DATASTORE, "push", onpush) );
}
void loop() {
// ↓ 必ず必要
milkcocoa.loop();
delay(1000);
}
이제 마이크로 컴퓨터 보드에 씁니다.
HoloLens를 시작하고 ESPrDeveloper도 시작합니다.
그러면 L치카가 잘 될 것입니다.

요약
매우 간단하게 HoloLens와 제휴가 가능했습니다.
응용하면 실제 라이트 등에 3D 오브젝트를 배치하여 HoloLens 위에서 라이트의 밝기를 조정하는 것도 가능한가 생각합니다.
그럼 멋진 HoloLens 생활을!
Reference
이 문제에 관하여(HoloLens와 ESPr® Developer에서 L 치카), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/h-takauma/items/a96582700b26d3d43d28
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
#include <Milkcocoa.h>
#include <ESP8266WiFi.h>
/************************* Your Milkcocoa Setup *********************************/
#define MILKCOCOA_APP_ID "xxxxxxxxxxxxx"
#define MILKCOCOA_DATASTORE "message"
/************* Milkcocoa Setup (you don't need to change this!) ******************/
#define MILKCOCOA_SERVERPORT 1883
//ご自分のルーターのSSIDを入力してください
const char* ssid = "XXXXXXX";
//ご自分のルーターのパスワード
const char* password = "XXXXXXXXXX";
// 使用するLEDのPin番号
int LedPin = 14;
// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;
const char MQTT_SERVER[] PROGMEM = MILKCOCOA_APP_ID ".mlkcca.com";
const char MQTT_CLIENTID[] PROGMEM = __TIME__ MILKCOCOA_APP_ID;
// Milkcocoa設定
Milkcocoa milkcocoa = Milkcocoa(&client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MILKCOCOA_APP_ID, MQTT_CLIENTID);
void onpush(DataElement *elem) {
Serial.println("onpush");
Serial.println(elem->getInt("v"));
if (elem->getInt("v") == 1) {
Serial.println("disp=1");
// LED点灯
digitalWrite(LedPin, HIGH);
} else {
Serial.println("disp=0");
// LED消灯
digitalWrite(LedPin, LOW);
}
};
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// connect to wifi.
WiFi.begin(ssid, password);
WiFi.mode(WIFI_STA); // omajinai
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(10000);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
// LED設定
pinMode(LedPin, OUTPUT);
// Milkcocoa初期化
Serial.println( milkcocoa.on(MILKCOCOA_DATASTORE, "push", onpush) );
}
void loop() {
// ↓ 必ず必要
milkcocoa.loop();
delay(1000);
}
매우 간단하게 HoloLens와 제휴가 가능했습니다.
응용하면 실제 라이트 등에 3D 오브젝트를 배치하여 HoloLens 위에서 라이트의 밝기를 조정하는 것도 가능한가 생각합니다.
그럼 멋진 HoloLens 생활을!
Reference
이 문제에 관하여(HoloLens와 ESPr® Developer에서 L 치카), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/h-takauma/items/a96582700b26d3d43d28텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)