pxt-ev3/docs/about.md
2020-01-02 12:39:24 -08:00

1.7 KiB

About

Welcome to the Microsoft MakeCode editor for the @boardname@!

Programming: Blocks or JavaScript

You can program the @boardname@ using Blocks or JavaScript in your web browser:

brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
    motors.largeA.run(50)
})
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
    motors.largeA.run(50)
})

The editor works in most modern browsers. It works offline once loaded and doesn't require any installation. Take a look at some of the features of the editor.

Compile and Flash: Your Program!

When you have your code ready, you connect your EV3 Brick to a computer with a USB cable so it appears as an attached drive (named @drivename@).

Compilation to machine code from Blocks or JavaScript happens in the browser. You save the binary program to a .uf2 file, which you then copy to the @drivename@ drive. The process of copying will flash the device with the new program.

~ hint

Bluetooth support

Experimental support for Bluetooth download is now available. Please read the Bluetooth page for more information.

~

Simulator: Test Your Code

You can run your code using the @boardname@ simulator, all inside the same browser window. The simulator has support for the EV3 Brick screen, buttons, sensors, and motors.

brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
    motors.largeA.run(50)
    motors.mediumD.run(50)
    sensors.touch1.pauseUntil(ButtonEvent.Pressed)
    sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectDetected)
})