UNPKG

@openhps/sphero

Version:

Open Hybrid Positioning System - Sphero component

48 lines 2.2 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RollableToy = void 0; const core_1 = require("./core"); class RollableToy extends core_1.Core { roll(speed, heading, flags) { return this.queueCommand(this.commands.driving.drive(speed, heading, flags)); } rollTime(speed, heading, time, flags) { return __awaiter(this, void 0, void 0, function* () { let drive = true; setTimeout(() => (drive = false), time); while (drive) { yield this.queueCommand(this.commands.driving.drive(speed, heading, flags)); } yield this.queueCommand(this.commands.driving.drive(0, heading, flags)); }); } allLEDsRaw(payload) { return this.queueCommand(this.commands.userIo.allLEDsRaw(payload)); } setBackLedIntensity(i) { return this.queueCommand(this.commands.userIo.setBackLedIntensity(i)); } setMainLedBlueIntensity(i) { return this.queueCommand(this.commands.userIo.setMainLedBlueIntensity(i)); } setMainLedColor(r, g, b) { return this.queueCommand(this.commands.userIo.setMainLedColor(r, g, b)); } setMainLedGreenIntensity(i) { return this.queueCommand(this.commands.userIo.setMainLedGreenIntensity(i)); } setMainLedRedIntensity(i) { return this.queueCommand(this.commands.userIo.setMainLedRedIntensity(i)); } } exports.RollableToy = RollableToy; //# sourceMappingURL=rollable-toy.js.map