In order to have a command or program run when the Pi boots, you can add it as a service. Once this is done, you can start/stop enable/disable from the linux prompt.
Create a service:
touch iot.service
Copy the content:
export default function logSocketLifeCycle(socket) { | |
socket.on('connect', async () => { | |
console.log(`[WEBSOCKET]: Connect to Dojot WebSocket - ` + new Date().toLocaleString()); | |
}); | |
socket.on('disconnect', () => { | |
console.log(`[WEBSOCKET]: Connection closed - ` + new Date().toLocaleString()); | |
}); | |
socket.on('reconnecting', (attemptNumber) => { |
In order to have a command or program run when the Pi boots, you can add it as a service. Once this is done, you can start/stop enable/disable from the linux prompt.
Create a service:
touch iot.service
Copy the content:
#include <ArduinoOTA.h> | |
#include <ESP8266WiFi.h> | |
#include <ESP8266httpUpdate.h> | |
#include <ESP8266mDNS.h> | |
#include <WiFiUdp.h> | |
#define THIS_DEVICE "esp_01l" | |
#define CURRENT_VERSION "0_0_1" | |
#define DEBUG_HTTP_UPDATE false |
{ | |
"env": { | |
"commonjs": true, | |
"es6": true, | |
"node": true | |
}, | |
"extends": "prettier", | |
"plugins": ["prettier"], | |
"globals": { | |
"Atomics": "readonly", |
import { SensorTypes, accelerometer, gyroscope, setUpdateIntervalForType } from "react-native-sensors"; | |
import { map, filter } from "rxjs/operators"; | |
class Vibration { | |
constructor({ updateInterval, offset }, callback) { | |
this.readings = { accelerometer: 0, gyroscope: 0, vibration: 0 }; | |
this.updateInterval = updateInterval; | |
this.callback = callback; |