Skip to content

Instantly share code, notes, and snippets.

@awayken
Last active August 4, 2019 13:55
Show Gist options
  • Save awayken/d5e972491c6660711e9bd187115c2e11 to your computer and use it in GitHub Desktop.
Save awayken/d5e972491c6660711e9bd187115c2e11 to your computer and use it in GitHub Desktop.
Robot Dance Club Promos
export enum RobotType {
Agriculture,
Constructor,
Drone,
Karaoke,
Vehicle
}
export interface IRobot {
readonly id: string;
readonly type: RobotType;
info(): string;
}
export class Robot implements IRobot {
readonly id: string;
readonly type: RobotType;
constructor(id: string, type: RobotType) {
this.id = id;
this.type = type;
}
info() {
return `Robot info: ${this.id} (${this.type})`;
}
}
export class KaraokeRobot extends Robot implements IRobot {
constructor(id: string) {
super(id, RobotType.Karaoke);
}
}
const holo = new KaraokeRobot('holo');
holo.say(holo.info());
import { Error } from './interface/robot_constants';
import { Volume, Effort } from './interface/karaoke_constants';
import { KaraokeRobot } from './implementation/KaraokeRobot';
const holo = new KaraokeRobot('holo');
await holo.goTo({
timestamp: 4715460060,
spacestamp: 'b0e66cb0-13e5'
});
await holo
.loadKaraoke('file:///human-songs-09.json')
.startKaraoke({
trackID: 'europe_the-final-countdown',
volume: Volume.Eleven,
projectionID: 'danny-foster_yasbm_1978',
useGlitter: true
effortLevel: Effort.Maximum
})
.catch(ex => holo.say(Error.Sorry, ex.message));
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR
#endif
#define PIN 6
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(18, 11, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
NEO_GRBW + NEO_KHZ800);
const uint16_t colors[] = {
matrix.Color(255, 0, 0),
matrix.Color(0, 255, 0),
matrix.Color(0, 0, 255)
};
void setup() {
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(40);
matrix.setTextColor(colors[0]);
}
int x = matrix.width();
int pass = 0;
void loop() {
matrix.fillScreen(0);
matrix.setCursor(x, 2);
// Copied and modified from:
// https://opentinkers.com/projects/led-display-programming/
matrix.print(F("ROBOT DANCE CLUB CREDITS SEQUENCE"));
if(--x < -65) {
x = matrix.width();
if(++pass >= 3) pass = 0;
matrix.setTextColor(colors[pass]);
}
matrix.show();
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment