pxt-ev3/libs/core/test.ts

51 lines
1.0 KiB
TypeScript
Raw Normal View History

2017-07-05 14:56:13 +02:00
screen.clear()
2017-07-05 18:53:22 +02:00
screen.setFont(ScreenFont.Large)
2017-07-06 18:58:15 +02:00
screen.drawText(10, 30, "Welcome PXT!")
2017-06-29 16:47:26 +02:00
2017-07-05 20:17:26 +02:00
screen.drawEllipse(40, 40, 20, 10, Draw.Fill)
output.setLights(LightsPattern.Orange)
input.buttonEnter.onEvent(ButtonEvent.Click, () => {
screen.clear()
})
input.buttonLeft.onEvent(ButtonEvent.Click, () => {
screen.drawRect(10, 70, 20, 10, Draw.Fill)
})
input.buttonRight.onEvent(ButtonEvent.Click, () => {
screen.setFont(ScreenFont.Normal)
screen.drawText(10, 60, "Bang!")
})
2017-07-05 14:56:13 +02:00
input.buttonDown.onEvent(ButtonEvent.Click, () => {
2017-07-05 20:17:26 +02:00
screen.scroll(-10)
2017-07-05 14:56:13 +02:00
})
input.buttonUp.onEvent(ButtonEvent.Click, () => {
2017-07-05 20:17:26 +02:00
screen.scroll(10)
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-07-10 15:26:19 +02:00
input.touchSensor.onEvent(ButtonEvent.Click, () => {
2017-07-10 13:47:00 +02:00
screen.drawText(10, 60, "Click! " + num)
num++
})
2017-07-10 15:26:19 +02:00
input.remoteTopLeft.onEvent(ButtonEvent.Click, () => {
2017-07-10 13:47:00 +02:00
screen.drawText(10, 60, "TOPLEFT " + num)
num++
})
2017-07-10 15:26:19 +02:00
input.remoteTopRight.onEvent(ButtonEvent.Down, () => {
2017-07-10 13:47:00 +02:00
screen.drawText(10, 60, "TOPRIGH " + num)
num++
})
loops.forever(() => {
serial.writeDmesg()
loops.pause(400)
})