GithubHelp home page GithubHelp logo

kiate / pxt-zoombit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cytrontechnologies/pxt-zoombit

0.0 0.0 0.0 331 KB

Cytron ZOOM:BIT Robot Car Kit for micro:bit

Home Page: https://cytrontechnologies.github.io/pxt-zoombit/

License: MIT License

Ruby 0.64% Makefile 0.62% TypeScript 98.74%

pxt-zoombit's Introduction

Cytron ZOOM:BIT Extension for Microsoft MakeCode

Cytron ZOOM:BIT Robot Car Kit for micro:bit comes with a booklet covering 9+1 hands-on building and coding lessons. You will follow the intuitive instructions guide to Build Your Own Robot and explore programming basics in a fun and engaging manner.

ZOOM:BIT

Educational Resources

Visit ZOOM:BIT Resource Hub if you need further assistance with ZOOM:BIT Robot Car Kit and its lessons.

Adding the Extension in MakeCode Editor

Examples

Headlights

Turn on headlights when button A is pressed, turn off when button B is pressed.

input.onButtonPressed(Button.A, function () {
    zoombit.setHeadlight(HeadlightChannel.All, zoombit.digitalStatePicker(DigitalIoState.On))
})
input.onButtonPressed(Button.B, function () {
    zoombit.setHeadlight(HeadlightChannel.All, zoombit.digitalStatePicker(DigitalIoState.Off))
})

DC Motors

Move robot forward at speed 128 when button A is pressed, brake/stop the robot when button B is pressed.

input.onButtonPressed(Button.A, function () {
    zoombit.move(MotorDirection.Forward, 128)
})
input.onButtonPressed(Button.B, function () {
    zoombit.brake()
})

Maker Line Sensor

Show line position on the LED matrix display. Please take note of the position of the micro:bit on ZOOM:BIT robot.

basic.forever(function () {
    if (zoombit.isLineDetectedOn(LinePosition.Left2)) {
        basic.showLeds(`
            . . . . #
            . . . . #
            . . . . #
            . . . . #
            . . . . #
            `)
    } else if (zoombit.isLineDetectedOn(LinePosition.Left1)) {
        basic.showLeds(`
            . . . # .
            . . . # .
            . . . # .
            . . . # .
            . . . # .
            `)
    } else if (zoombit.isLineDetectedOn(LinePosition.Center)) {
        basic.showLeds(`
            . . # . .
            . . # . .
            . . # . .
            . . # . .
            . . # . .
            `)
    } else if (zoombit.isLineDetectedOn(LinePosition.Right1)) {
        basic.showLeds(`
            . # . . .
            . # . . .
            . # . . .
            . # . . .
            . # . . .
            `)
    } else if (zoombit.isLineDetectedOn(LinePosition.Right2)) {
        basic.showLeds(`
            # . . . .
            # . . . .
            # . . . .
            # . . . .
            # . . . .
            `)
    } else {
        basic.clearScreen()
    }
})

Ultrasonic Sensor

Show Heart when an object is detected less 15cm away from the ultrasonic sensor, otherwise show Small Heart

basic.forever(function () {
    if (zoombit.readUltrasonic() < 15) {
        basic.showIcon(IconNames.Heart)
    } else {
        basic.showIcon(IconNames.SmallHeart)
    }
})

Supported targets

  • for PXT/microbit

Open this page at https://cytrontechnologies.github.io/pxt-zoombit/

<script src="https://makecode.com/gh-pages-embed.js"></script><script>makeCodeRender("{{ site.makecode.home_url }}", "{{ site.github.owner_name }}/{{ site.github.repository_name }}");</script>

pxt-zoombit's People

Contributors

kiate avatar waiweng83 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.