网易云

Ionic实战视频教程(跨平台): https://www.itying.com/goods-1067.html

Flutter实战视频教程(跨平台): https://www.itying.com/goods-1176.html

Serial

Contents

This plugin provides functions for working with Serial connections

https://github.com/xseignard/cordovarduino

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

Ionic Serial插件的安装(Installation)

ionic cordova plugin add cordovarduino npm install @ionic-native/serial
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/serial

Ionic Serial插件支持的平台(Supported Platforms)

  • Android
  • Ubuntu

Ionic Serial插件的用法(Usage)

import { Serial } from '@ionic-native/serial/ngx';

constructor(private serial: Serial) { }

...

this.serial.requestPermission().then(() => {
  this.serial.open({
    baudRate: 9800,
    dataBits: 4,
    stopBits: 1,
    parity: 0,
    dtr: true,
    rts: true,
    sleepOnPause: false
  }).then(() => {
    console.log('Serial connection opened');
  });
}).catch((error: any) => console.log(error));