Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Latest commit

 

History

History
84 lines (61 loc) · 1.47 KB

README.md

File metadata and controls

84 lines (61 loc) · 1.47 KB

Daydream-node

Update: This package is no longer working with the updated version of the Daydream controller's firmware. If you have not updated it, it might still work.

Quick Node.js module to connect to the Daydream controller and receive all data.

Installation:

Clone this repo and run:

npm install
node examples/simple.js

OR

npm install daydream-node

Usage:

Make sure your Bluetooth connection is on.

var daydream = require("daydream-node")();

daydream.onStateChange(function (data) {
  if (data.isClickDown) {
    // do something
  }
});

Data available:

Buttons events:

// returns true if the button is clicked.
.isClickDown
.isHomeDown
.isAppDown
.isVolPlusDown
.isVolMinusDown

Orientation:

// returns a float number with the orientation value for each axis.
.xOri
.yOri
.zOri

Accelerometer:

// returns a float number with the accelerometer value for each axis.
.xAcc
.yAcc
.zAcc

Gyroscope:

// returns a float number with the gyroscope value for each axis.
.xGyro
.yGyro
.zGyro

Touch events:

// returns a floating number between 0 and 1 representing the position of the finger on the main button on the x and y axis.
.xTouch
.yTouch

This module was built based on @mrdoob's previous work on the same concept using Web Bluetooth.