resetup led

This commit is contained in:
2024-03-03 11:52:41 +07:00
parent 1e5e16ff3e
commit ca72e479f3
18 changed files with 296 additions and 44 deletions

View File

@@ -1,16 +1,7 @@
import Firmata from 'firmata';
import { SuBoard } from './support';
export const comport: string = '/dev/ttyUSB0';
export const comport: string = '/dev/ttyUSB1';
export const board: Firmata = new Firmata(comport);
export const suBoard = {
connected: false,
PIN: {
servo: 0,
rgb_led: {
r: 10,
g: 9,
b: 8
}
}
}
export const suBoard: SuBoard = new SuBoard();

20
src/setup/support.ts Normal file
View File

@@ -0,0 +1,20 @@
export interface SupportBoard {
connected: boolean,
PINS: {
pwm: number[],
analog: number[],
}
sort: () => void
}
export class SuBoard implements SupportBoard {
public connected = false;
public PINS = {
pwm: [],
analog: []
};
public sort() {
this.PINS.pwm = this.PINS.pwm.sort((a, b) => b - a);
this.PINS.analog = this.PINS.analog.sort((a, b) => b - a);
}
}