-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharduino.ts
More file actions
42 lines (36 loc) · 1.1 KB
/
arduino.ts
File metadata and controls
42 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { registerRoomController, registerDeviceType } from "../../src/plugins.js";
import { LightStandardDevice } from "./device-types/light_standard.js";
import ArduinoSerialController from "./room-controllers/arduino_serial.js";
import { ThermometerDHTDevice } from "./device-types/thermometer_dht.js";
import { LightDimmableDevice } from "./device-types/light_dimmable.js";
import { LightRGBDevice } from "./device-types/light_rgb.js";
export enum ArduinoCommand {
pinMode = 0,
digitalWrite = 1,
digitalRead = 2,
analogWrite = 3,
analogRead = 4,
listenPin = 5,
DHT11 = 50,
DHT21 = 51,
DHT22 = 52,
}
export enum ArduinoEvent {
start = 0,
pinChange = 1
}
export enum PinMode {
INPUT = 0,
OUTPUT = 1,
INPUT_PULLUP = 2
}
export enum PinState {
LOW = 0,
HIGH = 1
}
registerRoomController(ArduinoSerialController);
registerDeviceType(LightStandardDevice);
registerDeviceType(LightDimmableDevice);
registerDeviceType(LightRGBDevice);
registerDeviceType(ThermometerDHTDevice);
export const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));