igbopie/spherov2.js

View on GitHub
examples/src/wake-sleep.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { starter } from './utils/starter';
import { Utils } from 'spherov2.js';
import { exit } from 'shelljs';
import { RollableToy } from 'spherov2.js';

export const wakeSleep = async (toy: RollableToy) => {
  await toy.setMainLedColor(255, 0, 0);
  await toy.setMainLedColor(0, 0, 255);
  await Utils.wait(2000);
  await toy.sleep();
  await toy.destroy();
  exit(0);
};

starter(wakeSleep);