Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 559
Domenico Monaco Avatar asked Aug 18 '14 16:08

Domenico Monaco


1 Answers

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:

  • open
  • close
  • write
  • onRead

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());
like image 152
Danny Tuppeny Avatar answered Oct 25 '22 16:10

Danny Tuppeny