# serial-arduino-app

> This project is an example of data interaction between arduino and node.

Latest version **1.0.2** (published 2020-03-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install serial-arduino-app
pnpm add serial-arduino-app
yarn add serial-arduino-app
bun add serial-arduino-app
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-03-18 |
| First published | 2020-03-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Caio Marques |
| Maintainers | caiomarqs |

## Links

- npm: https://www.npmjs.com/package/serial-arduino-app
- npm.io page: https://npm.io/package/serial-arduino-app

## Dependencies (1)

- [serialport](https://npm.io/package/serialport.md) ^8.0.7

## Recent versions

- 1.0.2 (latest) — 2020-03-18
- 1.0.1 — 2020-03-18
- 1.0.0 — 2020-03-18

## README

# Serial Arduino App
This project is an example of data interaction between *Arduino* and *Node.js*. See this document in [Portuguese](./README-ptBR.md).

### Run Project
- Install all *Node.js* dependencies:
```
    npm install
```
- Run a test of application on *Node.js*:
```
    npm test
```


### Configure Serial Listener

**Before running the application, connect the Arduino and run the program `.ino` on the Arduino IDE.**

This is a quick start, for more information see [Serial Port](https://serialport.io/docs/guide-about) documentation.

- Configure _Serial/USB_ port for listening:
```js
    const config = {
        log: false,
        port: 'COM3',
        baudRate: 9600,
        serialLog: true
    }
```

- Init connection on _Serial/USB_ port:
```js
    const SerialArduinoApp = require('serial-arduino-app')

    const config = {
        log: false,
        port: 'COM3',
        baudRate: 9600,
        serialLog: true
    }

    const serial = new SerialArduinoApp(config)

```

-  Example of data recived from Arduino:
```js
    serial.reciveDataToSerial() //Start recive data from serialport

    serial.on('serial-data', (serialdata) => {
        console.log(serialdata)
    })
```

- Example of data sended to Arduino:
```js
    serial.sendDataToSerial() //Start send data to serialport

    const emitter = new EventEmitter() //Use to simulate the event
    emitter.on('event', () => {
        setInterval(() => {
            serial.emit('send-data', '100') //Emit the data to Serial Port
        }, 50)
    })
    emitter.emit('event') // Force the event
```

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