rbaas293 / Arduino-TTL-Serial-DIO

Arduino Code For a Generic RS-232 USB Control Interface.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

  • NOTE as of 10/4/18 This repository has moved to GitLab as private. I may choose to mirror it here in the future.

RS-232 Serial Commands for Arduino DIO & PWM

This repository holds the code, libraries, and README created for use with a out of the box arduino uno.

1. Set Output

Description:

This command is used to set an output channel to a specified state. The state can be either HIGH or LOW.

Format: SOUT,<OUTPUT NUMBER>,<DESIRED STATE>

Example:

1. To SET an individual output HIGH.

  • Expected input command:
SOUT,3,1
  • Expected response:
SOUT,3,1
ACK,1

2. Toggle Output

Description:

This command is used to toggle an output channel HIGH or LOW, depending on the outputs current state.

Format: TOUT,<OUTPUT NUMBER>

Example:

1. To toggle an individual output:

  • Expected input command:
TOUT,2
  • Expected response:
TOUT,2
ACK,1

3. Pulse Output

Description:

This command is used to pulse an output channel HIGH for a specified time period less than 10,000ms.

Format: POUT,<OUTPUT NUMBER>,<PULSETIME>

Example:

1. To pulse an individual output for 58ms:

  • Expected input command:
POUT,5,58
  • Expected response:
POUT,5,58
ACK

4. Get Pin State(s)

Description:

This command is meant for individual output state queries or to display a table with each output and its corrisponding state.

Format: STAT,<OUTPUT NUMBER> or STAT

Examples:

1. To query an individual output:

  • Expected input command:
STAT,1
  • Expected response:
STAT,1
ACK,<OUTPUT 1 PIN STATE>

2. To query all 5 outputs, simply send: STAT

  • Expected input command: STAT
  • Expected response:
  STAT,ACK

  Output | State
  -------|-------
    O1   |   0
    O2   |   1
    O3   |   0
    O4   |   0
    O5   |   0

5. Query Scan Rate

Description:

This command is used to print the scan rate of the previous microprocessor loop.

Format: SRT?

6. Debug

Description:

This command is used to print debuging statments to the serial monitor. It can be very usefull to troubleshooting the firmware.

Format: DBUG

About

Arduino Code For a Generic RS-232 USB Control Interface.


Languages

Language:C++ 100.0%Language:PowerShell 0.0%