Giter VIP home page Giter VIP logo

pxt-powerbrick's Introduction

powerbrick

Feature

  1. The module adopts a high-quality plastic shell structure, and its size conforms to Lego standards: 3x7 and 7x7. Combining with Lego, you can make different projects quickly and easily and have more fun with programming.

  2. The anti-reverse PH2.0 cable is adopted to effectively avoid sensor damage caused by incorrect connection, make it safer to use and reduce the probability of damage and consumption of classroom equipment.

  3. A variety of sensors are included, 8 servos and 4 motors can be plugged in the expansion board, which allows children to use their imaginations freely.

  4. Most sensors have multiple functions. For example, the ultrasonic module not only has the function of distance measurement, but also has the function of sound intensity detection, so you can now use the most functions with the least wiring.

  5. The power supply in the Powerbrick kit adopts 18650 lithium battery, which has a large capacity and can be recharged repeatedly, and the battery box has the functions of anti-reverse connection and over-current protection of the lithium battery, so children can use it safely.

Basic usage

  • The Ultrasonic & Sound sensor module works and feeds back the data of distance and sound to the micro:bit

    input.onButtonPressed(Button.A, function () {
        basic.showNumber(powerbrick.Ultrasonic(powerbrick.Ports.PORT1))
    })
    input.onButtonPressed(Button.B, function () {
        basic.showNumber(powerbrick.SoundSensor(powerbrick.PortsA.PORT1))
    })



  • The buzzer sounds when the line tracker module detects a black line

    basic.forever(function () {
        if (powerbrick.Tracer(powerbrick.Ports.PORT1, powerbrick.Slots.A) || powerbrick.Tracer(powerbrick.Ports.PORT1, powerbrick.Slots.B)) {
            music.playTone(262, music.beat(BeatFraction.Whole))
        }
    })


  • Press the Bumper and the buzzer will sound

    basic.forever(function () {
        if (powerbrick.Bumper(powerbrick.Ports.PORT1, powerbrick.Slots.A) || powerbrick.Bumper(powerbrick.Ports.PORT1, powerbrick.Slots.B)) {
            music.playTone(262, music.beat(BeatFraction.Whole))
        }
    })


  • Temperature and humidity data will be displayed on micro:bit

    input.onButtonPressed(Button.A, function () {
        basic.showNumber(powerbrick.DHT11(powerbrick.Ports.PORT1, powerbrick.DHT11Type.TemperatureC))
    })
    

  • Let the servo(grey / limited in -45-225) and the motor(red / limited in -255-255) work.

    basic.forever(function () {
        powerbrick.MotorRun(powerbrick.Motors.M1, -255)
        powerbrick.Servo(powerbrick.Servos.S1, -45)
        basic.pause(2000)
        powerbrick.MotorRun(powerbrick.Motors.M1, 255)
        powerbrick.Servo(powerbrick.Servos.S1, 225)
        basic.pause(2000)
    })
    

  • The color & gesture module displays the color(Hue) value on the micro:bit

    input.onButtonPressed(Button.A, function () {
        basic.showNumber(powerbrick.GC_Color())
    })
    powerbrick.GC_MODE(powerbrick.GCMode.ColorSensor)


  • The color & gesture module will send 1~4 to the micro:bit means 4 directions, and 0 means no gestrue

    let now_ges = 0
    powerbrick.GC_MODE(powerbrick.GCMode.Gesture)
    basic.forever(function () {
        now_ges = powerbrick.GC_Color()
        if (!(now_ges == 0)) {
            basic.showNumber(now_ges)
        }
    })


  • The RFID module detects the RFID card, it will displays the UUID of the card and writes a piece of information to the card

    powerbrick.RfidPresent(function () {
        basic.showString(powerbrick.RfidUUID())
        basic.pause(500)
        powerbrick.RfidWrite(powerbrick.RfidSector.S1, powerbrick.RfidBlock.B0, "hello")
        basic.showString(powerbrick.RfidRead(powerbrick.RfidSector.S1, powerbrick.RfidBlock.B0))
    })
    basic.forever(function () {
        powerbrick.RfidProbe()
    })


  • Let the RGB module display

input.onButtonPressed(Button.A, function () {
    powerbrick.showColor(powerbrick.colors(powerbrick.NeoPixelColors.Red))
    powerbrick.rgbShow()
})
powerbrick.rgbConnect(powerbrick.Ports.PORT1)


  • MP3 will play mp3 audio stored in the tf card

input.onButtonPressed(Button.A, function () {
    powerbrick.MP3Play(powerbrick.PrevNext.Play)
})
powerbrick.MP3Connect(powerbrick.SerialPorts.PORT1)

License

MIT

Supported targets

  • for PXT/microbit
  • for PXT/meowbit

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.