1 |
|
2 | if (!Array.prototype.includes) {
|
3 | require("./array-includes-shim");
|
4 | }
|
5 |
|
6 | module.exports = {
|
7 |
|
8 | Accelerometer: require("./accelerometer"),
|
9 | Animation: require("./animation"),
|
10 | Altimeter: require("./altimeter"),
|
11 | Barometer: require("./barometer"),
|
12 | Board: require("./board"),
|
13 | Button: require("./button"),
|
14 | Color: require("./color"),
|
15 | Collection: require("./mixins/collection"),
|
16 | Compass: require("./compass"),
|
17 | ESC: require("./esc"),
|
18 | Expander: require("./expander"),
|
19 | Fn: require("./fn"),
|
20 | GPS: require("./gps"),
|
21 | Gripper: require("./gripper"),
|
22 | Gyro: require("./gyro"),
|
23 | Hygrometer: require("./hygrometer"),
|
24 | IMU: require("./imu"),
|
25 | Keypad: require("./keypad"),
|
26 | LCD: require("./lcd"),
|
27 | Led: require("./led"),
|
28 | LedControl: require("./led/ledcontrol"),
|
29 | Light: require("./light"),
|
30 | Joystick: require("./joystick"),
|
31 | Motion: require("./motion"),
|
32 | Motor: require("./motor"),
|
33 | Orientation: require("./orientation"),
|
34 | Piezo: require("./piezo"),
|
35 | Ping: require("./ping"),
|
36 | Pin: require("./pin"),
|
37 | Proximity: require("./proximity"),
|
38 | Relay: require("./relay"),
|
39 | Repl: require("./repl"),
|
40 | Sensor: require("./sensor"),
|
41 | Servo: require("./servo"),
|
42 | ShiftRegister: require("./shiftregister"),
|
43 | Sonar: require("./sonar"),
|
44 | Stepper: require("./stepper"),
|
45 | Switch: require("./switch"),
|
46 | Thermometer: require("./thermometer"),
|
47 | Wii: require("./wii")
|
48 |
|
49 | };
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | module.exports.Board.Virtual = function(opts) {
|
55 | var temp;
|
56 |
|
57 | if (opts instanceof module.exports.Expander) {
|
58 | temp = {
|
59 | io: opts
|
60 | };
|
61 | } else {
|
62 | temp = opts;
|
63 | }
|
64 |
|
65 | return new module.exports.Board(
|
66 | Object.assign({}, {
|
67 | repl: false,
|
68 | debug: false,
|
69 | sigint: false
|
70 | }, temp)
|
71 | );
|
72 | };
|
73 |
|
74 | module.exports.Multi = module.exports.IMU;
|
75 |
|
76 | module.exports.Analog = function(opts) {
|
77 | return new module.exports.Sensor(opts);
|
78 | };
|
79 |
|
80 | module.exports.Digital = function(opts) {
|
81 | var pin;
|
82 |
|
83 | if (typeof opts === "number" || typeof opts === "string") {
|
84 | pin = opts;
|
85 | opts = {
|
86 | type: "digital",
|
87 | pin: pin
|
88 | };
|
89 | } else {
|
90 | opts.type = opts.type || "digital";
|
91 | }
|
92 |
|
93 | return new module.exports.Sensor(opts);
|
94 | };
|
95 |
|
96 | module.exports.Sensor.Analog = module.exports.Analog;
|
97 | module.exports.Sensor.Digital = module.exports.Digital;
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | module.exports.Temperature = module.exports.Thermometer;
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 | module.exports.IR = function() {
|
109 | throw new Error("IR has been removed. Use Motion or Proximity instead.");
|
110 | };
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | module.exports.IR.Distance = function() {
|
116 | throw new Error("IR.Distance has been removed. Use Proximity instead.");
|
117 | };
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | module.exports.IR.Proximity = function() {
|
123 | throw new Error("IR.Proximity has been removed. Use Proximity instead.");
|
124 | };
|
125 |
|
126 |
|
127 |
|
128 |
|
129 | module.exports.IR.Motion = function() {
|
130 | throw new Error("IR.Motion has been removed. Use Motion instead.");
|
131 | };
|
132 |
|
133 |
|
134 | module.exports.IR.Reflect = {};
|
135 | module.exports.IR.Reflect.Array = require("./reflectancearray");
|
136 | module.exports.IR.Reflect.Collection = module.exports.IR.Reflect.Array;
|
137 |
|
138 | module.exports.Luxmeter = function(options) {
|
139 | return new module.exports.Light(options);
|
140 | };
|
141 |
|
142 | module.exports.Magnetometer = function(options) {
|
143 | return new module.exports.Compass(options);
|
144 | };
|
145 |
|
146 |
|
147 | module.exports.Boards = module.exports.Board.Collection;
|
148 | module.exports.Buttons = module.exports.Button.Collection;
|
149 | module.exports.ESCs = module.exports.ESC.Collection;
|
150 | module.exports.Leds = module.exports.Led.Collection;
|
151 | module.exports.Led.RGBs = module.exports.Led.RGB.Collection;
|
152 | module.exports.Motors = module.exports.Motor.Collection;
|
153 | module.exports.Pins = module.exports.Pin.Collection;
|
154 | module.exports.Relays = module.exports.Relay.Collection;
|
155 | module.exports.Sensors = module.exports.Sensor.Collection;
|
156 | module.exports.Servos = module.exports.Servo.Collection;
|
157 | module.exports.Switches = module.exports.Switch.Collection;
|
158 |
|
159 |
|
160 | module.exports.Touchpad = module.exports.Keypad;
|
161 |
|
162 |
|
163 | module.exports.Nunchuk = module.exports.Wii.Nunchuk;
|