serial-portdartrxtx

Using DartLang to comunicate via Serial port


I want to use DartLang to communicate with Arduino by Serial Port, not over TCP/ip. I've found DartLang chrome package and Chrome Serial reference, this is the solution ? Or there are some other solution to use Serial Port with DartLang?


Solution

  • Edit: https://pub.dev/packages/dart_serial_port was mentioned in the comments which is much more recent and uses Dart FFI.

    --

    Nicolas François has built a native Dart VM extension that does this:

    https://github.com/nfrancois/SerialPort

    You'll need to compile it yourself (requires gcc, make, pub):

    There's not a huge amount of info on how to use it, but there are some tests and the dart class that should be useful:

    Looks like you'd use it something like this:

    var serial =  new SerialPort(dummySerialPort.path);
    serial.onRead.listen((s) => print('Got: $s'));
    serial.open()
      .then((_) => serial.write("Hello"))
      //.then((_) => serial.close());