using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace repairedcomms
{
public partial class Form1 : Form
int[] data2 = new int[10];
int comsin;
float pressure;
string message1;
string message2;
public Form1()
InitializeComponent();
serialPort1.Open();
}
private void button1_Click(object sender, EventArgs e)
string outmessage = textInBox.Text.ToString();
serialPort1.RtsEnable = true;
serialPort1.DiscardInBuffer();
serialPort1.WriteLine(outmessage);
displayTextIn.Text = serialPort1.ReadLine();
serialPort1.RtsEnable = false;
serialPort1.DiscardOutBuffer();
private void dataInButton_Click(object sender, EventArgs e)
int datalength = serialPort1.BytesToRead;
byte[] data1 = new byte[datalength]; //this creates aan array
comsin = serialPort1.Read(data1, 0, datalength);
message1 = data1[1].ToString();
pressure = data1[2];
pressure = pressure / 100;
displayDataIn.Text = message1;
secondDataIn.Text = pressure.ToString();
private void button2_Click(object sender, EventArgs e)
message2 = newPressureSetting.Value.ToString();
displayDataIn.Text = message2;
serialPort1.WriteLine(message2);