Giter Club home page Giter Club logo

deno_serial's Introduction

Deno SerialPort

Tags License Sponsor

Serial Port API for Deno with zero third-party native dependencies.

Platform getPorts open
Windows
macOS
Linux

Try out

Run the following to list all available ports:

deno run --unstable --allow-ffi -r https://raw.githubusercontent.com/DjDeveloperr/deno_serial/main/examples/print_ports.ts

NOTE: Not yet published to deno.land/x as not all platforms are supported yet.

Usage

import { getPorts, open } from "https://deno.land/x/[email protected]/mod.ts";

const ports = getPorts();
console.log("Ports:", ports);

const port = open({ name: ports[0].name, baudRate: 9600 });

// ...

port.close();

License

Apache-2.0. Check LICENSE for more information.

Copyright © 2022-2023 DjDeveloperr

deno_serial's People

Contributors

djdeveloperr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

deno_serial's Issues

Suggestion: Add an example to `list_all_serial_ports`

An example to list all serial ports present, is like a hello word example for this kind of lib.

People should just type deno run <address_of_the_example> in their terminal and get to know if the lib can detect its own serial ports.

Normally if the lib pass this step, they believe it may be work in their project.

You should also add up above command line in the README.md so lib's lead can just copy and past in your terminal.

Note: I can pull request this change if necessary. Just let me know.

Thank you for write this amazing lib.

Cannot print serial ports on Windows 10

Maybe I'm doing something wrong, but I could not make the example to work on Windows 10.

Here is the reproduction of the error:

╰─❯ deno upgrade

Looking up latest version
Found latest version 1.34.1
Downloading https://github.com/denoland/deno/releases/download/v1.34.1/deno-x86_64-pc-windows-msvc.zip
Deno is upgrading to version 1.34.1
Upgraded successfully
Release notes: https://github.com/denoland/deno/releases/tag/v1.34.1
Blog post: https://deno.com/blog/v1.34

╰─❯ git clone https://github.com/DjDeveloperr/deno_serial.git

Cloning into 'deno_serial'...
remote: Enumerating objects: 77, done.
remote: Counting objects: 100% (77/77), done.
remote: Compressing objects: 100% (59/59), done.
Receiving objects:  58% (45/77)used 60 (delta 13), pack-reused 0
Receiving objects: 100% (77/77), 29.87 KiB | 2.99 MiB/s, done.
Resolving deltas: 100% (23/23), done.

╰─❯ cd .\deno_serial\examples\

╰─❯ deno run .\print_ports.ts

error: Uncaught TypeError: Deno.dlopen is not a function
export default Deno.dlopen("/System/Library/Frameworks/IOKit.framework/IOKit", {
                    ^
    at file:///C:/TEMP/deno_study/deno_serial/src/darwin/iokit.ts:5:21
    
        
╰─❯ deno --version

deno 1.34.1 (release, x86_64-pc-windows-msvc)
v8 11.5.150.2
typescript 5.0.4

╰─❯ $PSVersionTable.OS

Microsoft Windows 10.0.19045

PS: I apologize. for not answering your former ask for PR, I did not saw your message. My fault.

related #2

About support for others Operational Systems

Do you think it should be possible to call a Rust library from Deno using (using dlopen or something else) ?

Because we eventually could study to use the rust serial ports lib and just make a bridge between deno and the rust lib. I don't know if this would be valid solution in Deno.

Do you know if this should works for deno?

I can build and test the rust side, eventually.

PS: It seems that the maintainer of the rust serial lib, is the same mantainer of the node.js serial-lib.

related: #3 #2 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.