I have a card dispensing device in which I want to be triggered by a C# program.
The Card Dispensing Device has a command to trigger the card-out function.
Now when I checked the 42 is a hex and the H is just a hex determinator of some sort.
They gave me an exe which do the sending of data but I want to repliacte it and create my own.
In the exe that they gave when I press card out it shows a command like this one
-->[0x01] [0x42]
the first [] is for the device the second [] is the I think ascii hex of the command.
Here's the code I have so far
- using System.IO.Ports;
- namespace Card_Reader
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- using (SerialPort port = new SerialPort("COM2", 9600, Parity.None, 8))
- {
- byte[] bytesToSend = new byte[1] { 0x2A };
- port.Open();
- port.Write(bytesToSend, 0, 1);
- }
- }
I did not include all closing brackets.