- created code format for sent data - created parser for data - go.mod and go.sum added
30 lines
450 B
Go
30 lines
450 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
p "foglar/monitor/parse"
|
|
"foglar/monitor/serial_read"
|
|
"log"
|
|
)
|
|
|
|
func main() {
|
|
// Initialize serial connection
|
|
serialHandler, err := serial_read.NewSerialHandler()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
defer serialHandler.Close()
|
|
|
|
for {
|
|
// Read serial data
|
|
data, err := serialHandler.ReadSerial()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
fmt.Println("Received data:", data)
|
|
fmt.Println(p.Parser(data))
|
|
}
|
|
}
|