npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

megapi

v0.1.3

Published

node for megapi firmware

Downloads

4

Readme

Node For MegaPi

How To Use

  • Compile and upload the Firmware to your MegaPi ( https://github.com/Makeblock-Official/FirmwareForMegaPi )
  • On your Raspberry Pi,
npm install megapi
  • Insert the initial code for starting MegaPi first.
var MegaPi = require("megapi").MegaPi;
var bot = new MegaPi("/dev/ttyS0", onStart); //"/dev/ttyAMA0" for rpi2, "/dev/ttyS0" for rpi3
function onStart(){
  //start your code
  setTimeout(loop,500);
}
var level = 0;
function loop(){
  bot.digitalWrite(13, level);
  level = 1-level;
  setTimeout(loop,500);
}
  • node your code

Node API

  • Start
    • MegaPi( serialport, function onStart)
  • GPIO
    • digitalWrite( pin, level )
    • pwmWrite( pin, pwm )
    • digitalRead( pin, function onResult )
    • analogRead( pin, function onResult )
  • Motion
    • DC Motor
      • dcMotorRun( port, speed )
    • Servo Motor
      • servoRun( port, slot, angle )
    • Encoder Motor
      • encoderMotorRun( port, speed )
      • encoderMotorMove( port, speed, distance, function onFinish )
      • encoderMotorMoveTo( port, speed, position, function onFinish )
    • Stepper Motor
      • stepperMotorSetting( port, microsteps, acceleration )
      • stepperMotorRun( port, speed )
      • stepperMotorMove( port, speed, distance, function onFinish )
      • stepperMotorMoveTo( port, speed, position, function onFinish )
  • Sensors
    • Ultrasonic Sensor
      • ultrasonicSensorRead ( port, function onResult )
    • LineFollow Sensor
      • lineFollowerRead ( port, function onResult )
    • Light Sensor
      • lightSensorRead ( port, function onResult )
    • Sound Sensor
      • soundSensorRead ( port, function onResult )
    • Temperature Sensor
      • temperatureRead ( port, function onResult )
    • PIR Motion Sensor
      • pirMotionSensorRead ( port, function onResult )
    • Touch Sensor
      • touchSensorRead ( port, function onResult )
    • LimitSwitch
      • limitSwitchRead ( port, slot, function onResult )
    • Humiture Sensor
      • humitureSensorRead ( port, type, function onResult )
    • Gas Sensor
      • gasSensorRead ( port, function onResult )
    • Flame Sensor
      • flameSensorRead ( port, function onResult )
    • Button
      • buttonRead ( port, function onResult )
    • Potentiometer
      • potentiometerRead ( port, function onResult )
    • Joystick
      • joystickRead ( port, axis, function onResult )
    • 3-Axis Accelerometer and Gyro Sensor
      • gyroRead ( axis, function onResult )
    • Compass
      • compassRead ( function onResult )
  • Display
    • RGB Led
      • rgbledDisplay ( port, slot, index, r, g, b )
      • rgbledShow ( port, slot )
    • 7-segment Display
      • sevenSegmentDisplay ( port, value )
    • Led Matrix Display
      • ledMatrixMessage ( port, x, y, msg )
      • ledMatrixDisplay ( port, x, y, buffer )
    • Serial LCD Display
      • lcdDisplay ( string )
  • Others
    • DSLR Shutter
      • shutterOn ( port )
      • shutterOff ( port )
      • focusOn ( port )
      • focusOff ( port )