# iot-io

> JS binding for IO library

Latest version **0.1.1** (published 2014-07-21) · 0 weekly downloads

## Install

```sh
npm install iot-io
pnpm add iot-io
yarn add iot-io
bun add iot-io
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-07-21 |
| First published | 2014-07-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 9 |
| Author | Zhanglin Liu |
| Maintainers | ilc_opensource |

## Links

- npm: https://www.npmjs.com/package/iot-io
- Repository: https://github.com/ilc-opensource/io-js
- Issues: https://github.com/ilc-opensource/io-js/issues
- npm.io page: https://npm.io/package/iot-io

## Dependencies (1)

- [bindings](https://npm.io/package/bindings.md) *

## Recent versions

- 0.1.1 (latest) — 2014-07-21

## README

# IOT IO Library

A Javascript based IO library. It provides Arduino like APIs.

## Target execution environment

* Intel Galileo
* Intel Edsion (TODO) 

## Preinstall

* Please follow the document [Intel Galileo Getting Started](https://communities.intel.com/docs/DOC-22796) to install Yocto on Galileo and boot your board from a SD card

### Native compilation

If you have installed native gcc on Galileo board, you can login Galileo and install with npm. Please make sure node-gyp is installed

```shell
npm install -g node-gyp
```

Now you can begin to install iot-io and it may take several minutes.

```shell
npm install iot-io
```

### Cross compilation

If you don't install gcc on Galileo or just want a much faster compilation, please prepare a host Linux machine to setup cross compiler. 

* The Galileo Arduino IDE has contained a cross compiler, please download the Linux version from https://communities.intel.com/docs/DOC-22226 to your host Linux machine

* Make sure node-gyp is installed. If not install it with npm

```shell
sudo npm install -g node-gyp
```

* Set cross compiler environment. Save below script as `set_cross_compiler.sh` and change ARDUINO_PATH to correct path

```shell
ARDUINO_PATH="$HOME/arduino-1.5.3"
SYSROOT="$ARDUINO_PATH/hardware/tools/sysroots/i586-poky-linux-uclibc"
BIN_ROOT="$ARDUINO_PATH/hardware/tools/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux-uclibc/i586-poky-linux-uclibc-"
export CC="${BIN_ROOT}gcc --sysroot=$SYSROOT -m32 -march=i586"
export CXX="${BIN_ROOT}g++ --sysroot=$SYSROOT -m32 -march=i586"
export LINK=$CXX
$ARDUINO_PATH/hardware/tools/install_script.sh
```

* Then execute this script to set env.

```shell
chmod +x set_cross_compiler.sh
source set_cross_compiler.sh
```

* Now install the library with npm. By default it will be saved under ./node_modules/iot-io

```shell
npm install 
```

* Copy the whole directory to Galileo

## Quick start

We provide Arduino like APIs

* Set digital pin output and set its voltage high

```javascript
var IOLIB = require('iot-io');
var io = new IOLIB.IO({
  log: true,
});

io.pinMode(13, io.OUTPUT);
io.digitalWrite(13, io.HIGH);
```

* Turn on the led on pin 13 with friend API. Above example has done the same thing, but we want to use simpler and more direct interfaces.

```javascript
var IOLIB = require('iot-io');
var io = new IOLIB.IO({
  log: true,
});

var led = new IOLIB.Led({
  io: io,
  pin: 13
});

led.on();
```  

## APIs

Currently there are more than 100 APIs which come from the Intel Galileo Arduino SW. Please go to doc directory to know more details. These APIs are automatically generated with our tools, if you want to know more, please go to https://github.com/ilc-opensource/io-js

## License

The BSD License

---
_Source: https://npm.io/package/iot-io · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
