-
Notifications
You must be signed in to change notification settings - Fork 2
/
Program.cs
37 lines (33 loc) · 933 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.IO.Ports;
using Newtonsoft.Json;
using PH1800.Extra.RS485.Services;
namespace MonoInverter
{
static class Program
{
static void Main(string[] args)
{
String spID = "/dev/ttyUSB0";
if (args.Length > 0)
{
spID = "";
for (int i = 0; i < spID.Length; i++)
{
spID = spID + args[i];
}
}
using (SerialPort sp = new SerialPort(spID, 19200)
{
ReadTimeout = 1000,
WriteTimeout = 1000,
RtsEnable = true
})
{
var someData = Rs485ComServer.GetPartData(4, 4, sp);
string output = JsonConvert.SerializeObject(someData);
Console.WriteLine(output);
}
}
}
}