obniz Docs
  • obniz.com
  • Developer's Console
  • Guides
  • Reference

obniz.js, Device Control

  • Overview
  • Class Obniz
    • Obniz.M5StickC
    • Obniz.M5StackBasic
  • Connection
    • Disconnection And Reset
    • Multiple Connection
    • Local Connect
    • Closed Network
    • compatibility
  • Wait and Repeat
  • PartsLibrary
    • Import hosted parts
    • Create owned parts
  • IO
    • Output
    • Input
    • DriveMethod
    • Pull-up-down
  • IO-Animation
  • AD
  • PWM
    • Modulation
  • UART
    • Send
    • Receive
  • SPI
    • Master Read/Write
  • I2C
    • Master Read/Write
    • Slave Read
  • LogicAnalyzer
  • Measurement
  • Display
  • Switch
  • Sleep
  • TCP
  • Wi-Fi
  • BLE
    • Central: Scan
    • Central: Advanced conditional scanning
    • Central: Connection
    • Central: Pairing
    • Central: Services and characteristics
    • Central: Read and Write
    • Central: Receiving change notifications
    • Peripheral: Advertisement
    • Peripheral: Services and characteristics registration
    • Peripheral: Monitoring update
    • Peripheral: Update values
    • Peripheral: Notification of value change
  • Connected Network
  • Metadata
  • Messaging
  • App
  • Plugin
  • Changelog
obniz Docs Reference obniz.js, Device Control PartsLibrary Import hosted parts

Import hosted parts

When hosted parts library is not included officially in obniz.js, you need to import it code and register to obniz.js. PartsRegistrate() function will do registration.

Below is a example of registering MYLED class to Obniz parts library.
After that, call wired() to use it.

// Javascript Example

Obniz.PartsRegistrate(MYLED);
var led = obniz.wired("MYLED", { anode:0, cathode:1 } );
led.onesec();

Doc navigation

Create owned parts →
© 2020 obniz Docs
IoT for all developer with just obniz | iot.obniz.com

タイトル

本文