Giter VIP home page Giter VIP logo

lmissel / system.io.ports.commands Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 79 KB

The module System.IO.Ports.Commands provides serial ports as a resource. It thus allows you to quickly and easily send and receive data via such a resource. In addition, monitoring is included that provides a DataReceived event as a Powershell event as soon as the resource receives data.

PowerShell 100.00%
powershell serialport

system.io.ports.commands's Introduction

System.IO.Ports.Commands

The module System.IO.Ports.Commands provides serial ports as a resource. It thus allows you to quickly and easily send and receive data via such a resource. In addition, monitoring is included that provides a DataReceived event as a Powershell event as soon as the resource receives data.

Description

The System.IO.Ports.Commands module contains cmdlets for controlling serial ports. The module uses the classes and enumerations of the namepace System.IO.Ports, which simplify the control of serial ports, e.g. handshake, parity, SerialPinChange, and StopBits. The most important class, is the SerialPort class. It provides a framework for synchronous and event-driven I/O operations, access to pin and interrupt states, and access to the driver properties for the serial port.

Minimum Requirements

The module requires .NET and PowerShell. The following versions are supported:

Product Version
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Platform Extensions 2.1, 2.2, 3.0, 3.1, 5.0, 6.0 Preview 3
PowerShell 3.0 or higher

Installation

To install and run this module, copy the folder with the name System.IO.Ports.Commands in one of the appropriate PowerShell paths and use Import-Module -name System.IO.Ports.Commands.

The paths where you can install this module are in the $env:PSModulePath global variable. For example, a common path to store a module on a system would be %SystemRoot%/users/<user>/Documents/PowerShell/Modules/<moduleName>. Be sure to create a directory for this module that uses the same name System.IO.Ports.Commands as the script module. If you did not save this module in one of these paths, you must specify the location of the module in the Import-Module command. Otherwise, PowerShell would not be able to find the module.

Starting with PowerShell, if you've placed this module in one of the PowerShell module paths, you don't need to explicitly import it. This module is automatically loaded when a user calls a function of the module. For more information about the module path, see Importing a PowerShell Module and Modifying the PSModulePath Installation Path.

To remove this module from active service in the current PowerShell session, use Remove-Module -name System.IO.Ports.Commands.

Note

Remove-Module removes a module from the current PowerShell session, but doesn't uninstall the module or delete the module's files.

Usage

In this example we output the phrase "Hello World!" to the SerialPort COM3 and wait for a response. Then we read the data. Finally, we close the SerialPort so that it is available again.

# Loading the powershell module
Import-Module System.IO.Ports.Commands

# Opens the serialport COM3
$SerialPort = Open-SerialPort -portName COM3

# Write data to serialport
Write-SerialPort -InputObject $SerialPort -Text "Hello World!"

# Wait max. 3 seconds for a response
Wait-DataReceivedEvent -InputObject $SerialPort -Timeout 3

# Read all existing data from serialport
Read-SerialPort -InputObject $SerialPort -Existing

# Closes the serialport COM3
Close-SerialPort -InputObject $SerialPort
Output:
Hello back!

Changelog

Version State Comment
1.0.0.0 done Initial module
1.1.0.0 done New structure and division of the module and functions, multilingualism, bug fixes as well as enhancements.
1.1.1.0 in Progress Adaptation to the new internal standard of a script module.

ToDo

  • Adaptation to the new internal standard of a script module.
  • The creation of a german external help file.

Important

Some functions may have been renamed or given additional functionality. Please check your scripts for functionality and correct them if necessary.

Notes

The module uses enumerations and classes of the namepace [System.IO.Ports].

See also

system.io.ports.commands's People

Contributors

lmissel avatar

Stargazers

 avatar

Watchers

 avatar

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.