sudo apt-get update
load 'deploy' | |
load 'deploy/assets' # Assets pipeline for Rails application | |
load 'config/deploy' |
-
Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.
-
Reset PS3 controller by inserting paperclip into pinhole near L2 button.
-
Connect PS3 controller to Mac with USB cable.
-
Enable Bluetooth.
// The received message is stored in 'msg' | |
// It will have at least a 'payload' property: | |
// console.log(msg.payload); | |
// The 'context' object is available to store state | |
// between invocations of the function | |
// context = {}; | |
//expects JSON payload and destination specified in topic | |
var key = "your api key here"; |
-- Your access point's SSID and password | |
local SSID = "greenhouse" | |
local SSID_PASSWORD = "senhasupersecreta" | |
local DEVICE = "undefined" | |
local temperature = 27.5 | |
local timesRunned = 0 | |
-- configure ESP as a station | |
wifi.setmode(wifi.STATION) | |
wifi.sta.config(SSID,SSID_PASSWORD) |
-- *************************************************************************** | |
-- BH1750 module for ESP8266 with nodeMCU | |
-- BH1750 compatible tested 2015-1-22 | |
-- | |
-- Written by xiaohu | |
-- | |
-- MIT license, http://opensource.org/licenses/MIT | |
-- *************************************************************************** | |
local moduleName = ... | |
local M = {} |
// Load accelerometer | |
var adxl345 = require('jsupm_adxl345'); | |
// Instantiate on I2C bus | |
var adxl = new adxl345.Adxl345(0); | |
// Initialize the hardware device | |
var screen = new (require("jsupm_i2clcd").SSD1308)(0, 0x3C); | |
// Displays a message on the OLED display |
First experiments with NodeMCU to publish the current settings of my adjustable height working desk to MQTT.
NodeMCU can be found here: https://github.com/nodemcu/nodemcu-firmware
Note that you'll need a current version with support for floats (which the ultrasonic sensor library utilizes), I'm using 0.9.5 2015-03-18 with float support myself.
Support for the HC-SR04 sensor in NodeMCU can be found here: https://github.com/sza2/node_hcsr04
I provided my slightly adjusted version which makes measuring a non-blocking afair, allowing for callbacks when the measurement completes.
###Creating a REST API using Node.js, Express, and MongoDB
####Installing Node.js
Go to http://nodejs.org, and click the Install button. Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at /usr/local/bin/node and npm was installed at /usr/local/bin/npm. At this point node.js is ready to use. Let’s implement the webserver application from the nodejs.org home page. We will use it as a starting point for our project: a RESTful API to access data (retrieve, create, update, delete) in a wine cellar database.
Create a folder named nodecellar anywhere on your file system. In the wincellar folder, create a file named server.js.