pxt-ev3/libs/core/test.ts

61 lines
1.3 KiB
TypeScript
Raw Normal View History

2017-07-05 14:56:13 +02:00
screen.clear()
2017-10-24 14:30:05 +02:00
screen.print("PXT!", 10, 30, Draw.Quad)
2017-06-29 16:47:26 +02:00
2017-07-11 14:43:12 +02:00
screen.drawRect(40, 40, 20, 10, Draw.Fill)
2017-10-27 20:01:11 +02:00
motors.setStatusLight(LightsPattern.Orange)
2017-07-05 20:17:26 +02:00
2017-08-08 11:41:31 +02:00
screen.drawIcon(100, 50, screen.doubleIcon(screen.heart), Draw.Double | Draw.Transparent)
2017-07-11 14:43:12 +02:00
2017-10-28 18:13:02 +02:00
sensors.buttonEnter.onEvent(ButtonEvent.Click, () => {
2017-07-05 20:17:26 +02:00
screen.clear()
})
2017-10-28 18:13:02 +02:00
sensors.buttonLeft.onEvent(ButtonEvent.Click, () => {
2017-07-05 20:17:26 +02:00
screen.drawRect(10, 70, 20, 10, Draw.Fill)
2017-10-27 20:01:11 +02:00
motors.setStatusLight(LightsPattern.Red)
2017-07-11 15:40:27 +02:00
screen.setFont(screen.microbitFont())
2017-07-05 20:17:26 +02:00
})
2017-10-28 18:13:02 +02:00
sensors.buttonRight.onEvent(ButtonEvent.Click, () => {
2017-10-24 14:30:05 +02:00
screen.print("Right!", 10, 60)
2017-07-05 20:17:26 +02:00
})
2017-07-05 14:56:13 +02:00
2017-10-28 18:13:02 +02:00
sensors.buttonDown.onEvent(ButtonEvent.Click, () => {
2017-10-24 14:30:05 +02:00
screen.print("Down! ", 10, 60)
2017-07-05 14:56:13 +02:00
})
2017-10-28 18:13:02 +02:00
sensors.buttonUp.onEvent(ButtonEvent.Click, () => {
2017-10-24 14:30:05 +02:00
screen.print("Up! ", 10, 60)
2017-07-05 14:56:13 +02:00
})
2017-07-02 13:32:17 +02:00
2017-07-10 13:47:00 +02:00
let num = 0
2017-10-28 18:13:02 +02:00
sensors.touchSensor1.onEvent(TouchSensorEvent.Bumped, () => {
2017-10-24 14:30:05 +02:00
screen.print("Click! " + num, 10, 60)
2017-07-10 13:47:00 +02:00
num++
})
2017-10-28 18:13:02 +02:00
sensors.remoteButtonTopLeft.onEvent(ButtonEvent.Click, () => {
2017-10-24 14:30:05 +02:00
screen.print("TOPLEFT " + num, 10, 60)
2017-07-10 13:47:00 +02:00
num++
})
2017-10-28 18:13:02 +02:00
sensors.remoteButtonTopRight.onEvent(ButtonEvent.Down, () => {
2017-10-24 14:30:05 +02:00
screen.print("TOPRIGH " + num, 10, 60)
2017-07-10 13:47:00 +02:00
num++
})
loops.forever(() => {
serial.writeDmesg()
2017-07-10 15:43:54 +02:00
loops.pause(100)
2017-07-10 13:47:00 +02:00
})
2017-07-10 15:43:54 +02:00
/*
loops.forever(() => {
let v = input.color.getColor()
2017-10-24 14:30:05 +02:00
screen.print(10, 60, v + " ")
2017-07-10 15:43:54 +02:00
loops.pause(200)
})
2017-10-24 20:58:52 +02:00
*/