Skip to content

Commit

Permalink
added to protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Sep 20, 2023
1 parent 820e83e commit c696478
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 1 addition & 3 deletions robot/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ namespace microcode {

export enum RobotCommand {
MotorRun = 0x0001,
}
export enum RobotDrivers {
MicroMaqqueen = 0x01
LedSetColor = 0x0002,
}

export function createRobotCommand(cmd: RobotCommand, payload: Buffer) {
Expand Down
7 changes: 7 additions & 0 deletions robot/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ namespace microcode {
robot.motorRun(speed)
break
}
case RobotCommand.LedSetColor: {
const red = payload[0]
const green = payload[1]
const blue = payload[2]
console.log(`led set color ${red} ${green} ${blue}`)
robot.ledSetColor(red, green, blue)
}
}
})
}

0 comments on commit c696478

Please sign in to comment.