EDN Admin
Well-known member
I have a USB device that is "seen" as a COM Port. It has eight channels, each require a single character to turn ON/OFF. Its a http://www.dlpdesign.com/usb/io8.shtml DLP-IO8 for reference. I have the COM port part
working 100%.
1-8 turns ON each channel (12345678)
Q-I turns OFF each channel (QWERTYUI)
<pre style="color:#333333; font-family:inherit; font-size:13px; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; padding:0px; margin:0px; border:initial initial initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial Truth table for device: 1 = Ch1 ON | Q = Ch1 OFF 2 = Ch2 ON | W = Ch2 OFF 3 = Ch3 ON | E = Ch3 OFF --- 8 = Ch8 ON | I = Ch8 OFF [/code]
Sending a "124" will turn on channels 1, 2 and 4.
Sending a "QWR" will turn off channels 1, 2 and 4.
I want to randomize ON/OFF output of device with "on-the-fly" speed control.
cmbSPRan.Value is my NumericUpDown starting at 1 and ending with 10 default is 5 for speed control
Randomize code:
<span style="font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; font-size:x-small -------------------------
<div style="color:black; background-color:white
<pre>RandomNumber = RandomClass.<span style="color:blue Next(1, 87654321)
SerialPort1.Write(RandomNumber)
Timer1.Interval = (cmbSPRan.Value) * 250
[/code]
<pre style="outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; word-wrap:break-word; padding:0px; margin:0px; border:initial initial initial <span style="white-space:normal <br/>[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif ---------------------------[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif Button control code:<span style="font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; font-size:x-small [/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; font-size:x-small ---------------------------[/code]
<div style="color:black; background-color:white
<pre><span style="color:blue Private <span style="color:blue Sub btnRRan_Click(<span style="color:blue ByVal sender <span style="color:blue As System.Object, <span style="color:blue ByVal e <span style="color:blue As System.EventArgs) <span style="color:blue Handles btnRRan.Click
btnRRan.Enabled = <span style="color:blue False
btnSRan.Enabled = <span style="color:blue True
<span style="color:green ---code to start randomize and allow speed control
<span style="color:blue End <span style="color:blue Sub
<span style="color:blue Private <span style="color:blue Sub btnSRan_Click(<span style="color:blue ByVal sender <span style="color:blue As System.Object, <span style="color:blue ByVal e <span style="color:blue As System.EventArgs) <span style="color:blue Handles btnSRan.Click
btnSRan.Enabled = <span style="color:blue False
btnRRan.Enabled = <span style="color:blue True
<span style="color:green ---code to stop randomize and clear all outputs
SerialPort1.Write(<span style="color:#a31515 "QWERTYUI")
<span style="color:blue End <span style="color:blue Sub
[/code]
<br/>
<pre style="outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; word-wrap:break-word; text-align:left; padding:0px; margin:0px; border:initial none initial <span style="color:#333333; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; font-size:x-small <span style="line-height:16px ------------------------ [/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <code style="font-style:inherit; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; vertical-align:baseline; background-color:#eeeeee; padding:0px; margin:0px; border:0px initial initial <span style="font-style:inherit; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; padding:0px; margin:0px; border:0px initial initial
I need: <ol><li style="font-style:inherit; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:decimal; text-decoration:none; vertical-align:baseline; background-color:transparent; word-wrap:break-word; padding:0px; margin:0px; border:initial none initial a loop that I can still use the functions of the form (change speed or Stop loop).<li style="font-style:inherit; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:decimal; text-decoration:none; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; background-color:transparent; padding:0px; margin:0px; border:0px initial initial a way to utilize Q-I to turn the channels OFF randomly</ol>
<span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; background-color:#ffffff; padding:0px; margin:0px; border:0px initial initial Ive been searching for a few days with little luck. Ive tried Do Until, Do While loops and a few others.
[/code][/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial Any help with coding is appreciated?[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial <br/>[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial Ive only been coding for a few days now so go easy. Learning as I go.[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial My form - http://i81.photobucket.com/albums/j230/sparky3489/PC%20interface/Form.png" target="_blank" title="COMControl http://i81.photobucket.com/albums/j230/sparky3489/PC%20interface/Form.png [/code]
<pre style="outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; padding:0px; margin:0px; border:initial none initial <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px; white-space:normal <br/>[/code]
<pre style="outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; padding:0px; margin:0px; border:initial none initial <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px; white-space:normal <br/>[/code]
<br/>
<br/>
<br/>
View the full article
working 100%.
1-8 turns ON each channel (12345678)
Q-I turns OFF each channel (QWERTYUI)
<pre style="color:#333333; font-family:inherit; font-size:13px; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; padding:0px; margin:0px; border:initial initial initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial Truth table for device: 1 = Ch1 ON | Q = Ch1 OFF 2 = Ch2 ON | W = Ch2 OFF 3 = Ch3 ON | E = Ch3 OFF --- 8 = Ch8 ON | I = Ch8 OFF [/code]
Sending a "124" will turn on channels 1, 2 and 4.
Sending a "QWR" will turn off channels 1, 2 and 4.
I want to randomize ON/OFF output of device with "on-the-fly" speed control.
cmbSPRan.Value is my NumericUpDown starting at 1 and ending with 10 default is 5 for speed control
Randomize code:
<span style="font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; font-size:x-small -------------------------
<div style="color:black; background-color:white
<pre>RandomNumber = RandomClass.<span style="color:blue Next(1, 87654321)
SerialPort1.Write(RandomNumber)
Timer1.Interval = (cmbSPRan.Value) * 250
[/code]
<pre style="outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; word-wrap:break-word; padding:0px; margin:0px; border:initial initial initial <span style="white-space:normal <br/>[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif ---------------------------[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif Button control code:<span style="font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; font-size:x-small [/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; font-size:x-small ---------------------------[/code]
<div style="color:black; background-color:white
<pre><span style="color:blue Private <span style="color:blue Sub btnRRan_Click(<span style="color:blue ByVal sender <span style="color:blue As System.Object, <span style="color:blue ByVal e <span style="color:blue As System.EventArgs) <span style="color:blue Handles btnRRan.Click
btnRRan.Enabled = <span style="color:blue False
btnSRan.Enabled = <span style="color:blue True
<span style="color:green ---code to start randomize and allow speed control
<span style="color:blue End <span style="color:blue Sub
<span style="color:blue Private <span style="color:blue Sub btnSRan_Click(<span style="color:blue ByVal sender <span style="color:blue As System.Object, <span style="color:blue ByVal e <span style="color:blue As System.EventArgs) <span style="color:blue Handles btnSRan.Click
btnSRan.Enabled = <span style="color:blue False
btnRRan.Enabled = <span style="color:blue True
<span style="color:green ---code to stop randomize and clear all outputs
SerialPort1.Write(<span style="color:#a31515 "QWERTYUI")
<span style="color:blue End <span style="color:blue Sub
[/code]
<br/>
<pre style="outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; word-wrap:break-word; text-align:left; padding:0px; margin:0px; border:initial none initial <span style="color:#333333; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; font-size:x-small <span style="line-height:16px ------------------------ [/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <code style="font-style:inherit; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; vertical-align:baseline; background-color:#eeeeee; padding:0px; margin:0px; border:0px initial initial <span style="font-style:inherit; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; padding:0px; margin:0px; border:0px initial initial
I need: <ol><li style="font-style:inherit; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:decimal; text-decoration:none; vertical-align:baseline; background-color:transparent; word-wrap:break-word; padding:0px; margin:0px; border:initial none initial a loop that I can still use the functions of the form (change speed or Stop loop).<li style="font-style:inherit; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:decimal; text-decoration:none; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; background-color:transparent; padding:0px; margin:0px; border:0px initial initial a way to utilize Q-I to turn the channels OFF randomly</ol>
<span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; background-color:#ffffff; padding:0px; margin:0px; border:0px initial initial Ive been searching for a few days with little luck. Ive tried Do Until, Do While loops and a few others.
[/code][/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial Any help with coding is appreciated?[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial <br/>[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial Ive only been coding for a few days now so go easy. Learning as I go.[/code]
<pre style="font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; font-size:13px; line-height:16px; padding:0px; margin:0px; border:initial none initial <span style="font-style:inherit; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; outline-width:0px; outline-style:initial; outline-color:initial; font-size:14px; line-height:18px; white-space:normal; padding:0px; margin:0px; border:0px initial initial My form - http://i81.photobucket.com/albums/j230/sparky3489/PC%20interface/Form.png" target="_blank" title="COMControl http://i81.photobucket.com/albums/j230/sparky3489/PC%20interface/Form.png [/code]
<pre style="outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; padding:0px; margin:0px; border:initial none initial <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px; white-space:normal <br/>[/code]
<pre style="outline-width:0px; outline-style:initial; outline-color:initial; list-style-type:none; text-decoration:none; word-wrap:break-word; text-align:left; color:#333333; padding:0px; margin:0px; border:initial none initial <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px; white-space:normal <br/>[/code]
<br/>
<br/>
<br/>
View the full article