Giter Site home page Giter Site logo

pxt-oc05's Introduction

GitHub Issues GitHub Commit Maintained Build status badge Build status badge

pxt-OC05

This is the MakeCode Package for the OC05 xChip.

Getting Started

  1. Open Microsoft MakeCode for micro:bit.
  2. Select Advanced > Add Package in the toolbox.
  3. Copy and paste https://github.com/xinabox/pxt-OC05 in the search bar and click search
  4. Select the package by clicking on it. The package will appear along with the existing packages in the toolbox.

Blocks

setServoPosition

setServoPosition(servoChannel: number, degrees: number)

Positions a servo on the selected channel a desired degree of rotation.

  • servoChannel: the channel number on the OC05 (1 - 8)
  • degrees: desired degree of rotation

setCRServoPosition

setCRServoPosition(servoChannel: number, speed: number)

Rotates a servo on the selected channel with desired percent of speed

  • servoChannel: the channel number on the OC05 (1 - 8)
  • speed: percent of speed to rotate (-100% - 100%)

setServoLimits

setServoLimits(servoChannel: number, minimum: number, maximum: number)

Bound servo motor movement within maximum and minimum degrees entered

  • servoChannel: the channel number on the OC05 (1 - 8)
  • minimum: lower limit of servo movement in degrees
  • maximum: upper limit of servo movement in degrees

Example Usage

input.onButtonPressed(Button.A, () => {
    OC05.setServoPosition(OC05.ServoNum.Servo1, 0)
    basic.showString("A")
})
input.onButtonPressed(Button.B, () => {
    OC05.setServoPosition(OC05.ServoNum.Servo1, 180)
    basic.showString("B")
})
input.onButtonPressed(Button.AB, () => {
    OC05.setServoPosition(OC05.ServoNum.Servo1, 90)
    basic.showString("C")
})

License

MIT

Supported targets

  • for PXT/microbit
OC05=github:xinabox/pxt-OC05

pxt-oc05's People

Contributors

gotfredsen avatar kalbeabbas avatar luqmaanb avatar pragmaticphil avatar

Watchers

 avatar  avatar

Forkers

kalbeabbas

pxt-oc05's Issues

Can we clone the MakeCode servo library and update?

Our OC05 library needs some work for the microbit users.

MakeCode has a servo library - its one of the first options you see when you open extensions.
It is laid out nicely and is easy enough to understand.
It has all the functionality we need, just without being able to choose from 8 servos.
Can we clone theirs - gut it if needs be, but keep the front end? Or copy their functions / groupings?

Thoughts?

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.