diff --git a/.gitignore b/.gitignore index ac20b45..9a23d88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ 2024*.txt test/* + +serial_read/go.mod + +serial_read/go.sum + +*.exe diff --git a/doc/Nano.png b/doc/Nano.png new file mode 100644 index 0000000..d517545 Binary files /dev/null and b/doc/Nano.png differ diff --git a/doc/UnoR4Wifi.png b/doc/UnoR4Wifi.png new file mode 100644 index 0000000..e08aecd Binary files /dev/null and b/doc/UnoR4Wifi.png differ diff --git a/receiver_module/nRF24L01_receiver.ino b/receiver_module/receiver_module.ino similarity index 93% rename from receiver_module/nRF24L01_receiver.ino rename to receiver_module/receiver_module.ino index cb54038..8e928ac 100644 --- a/receiver_module/nRF24L01_receiver.ino +++ b/receiver_module/receiver_module.ino @@ -7,7 +7,7 @@ void setup() { while (!Serial) ; Serial.begin(9600); - Serial.println("Reciver init"); + Serial.println("# Reciever Init"); radio.begin(); radio.openReadingPipe(0, address); //set the address radio.startListening(); //Set module as receiver diff --git a/sender_module/sender_module.ino b/sender_module/sender_module.ino index ceaaba4..04ac6fc 100644 --- a/sender_module/sender_module.ino +++ b/sender_module/sender_module.ino @@ -6,7 +6,7 @@ bool gbSenserConnectState = false; -//create an RF24 object +//create an RF24 objetct RF24 radio(9, 8); // CE, CSN const byte address[6] = "00001"; //address through which two modules communicate @@ -24,19 +24,19 @@ void setup() { imuInit(&enMotionSensorType, &enPressureType); if(IMU_EN_SENSOR_TYPE_ICM20948 == enMotionSensorType) { - Serial.println("Motion sersor is ICM-20948"); + Serial.println("# Motion sersor is ICM-20948"); } else { - Serial.println("Motion sersor NULL"); + Serial.println("# Motion sersor NULL"); } if(IMU_EN_SENSOR_TYPE_BMP280 == enPressureType) { - Serial.println("Pressure sersor is BMP280"); + Serial.println("# Pressure sersor is BMP280"); } else { - Serial.println("Pressure sersor NULL"); + Serial.println("# Pressure sersor NULL"); } delay(1000); } diff --git a/serial_read/go.mod b/serial_read/go.mod deleted file mode 100644 index ac0afd1..0000000 --- a/serial_read/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module foglar/serial_read - -go 1.21.6 - -require github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 - -require golang.org/x/sys v0.16.0 // indirect diff --git a/serial_read/go.sum b/serial_read/go.sum deleted file mode 100644 index bf059e4..0000000 --- a/serial_read/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 h1:UyzmZLoiDWMRywV4DUYb9Fbt8uiOSooupjTq10vpvnU= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/serial_read/path_unix.go b/serial_read/path_unix.go new file mode 100644 index 0000000..8e7bbb2 --- /dev/null +++ b/serial_read/path_unix.go @@ -0,0 +1,38 @@ +//go:build !windows +// +build !windows + +package main + +import ( + "fmt" + "github.com/mitchellh/go-homedir" + "log" + "os" +) + +var ( + HOME string + PATH string +) + +// Check if the directory exists +func init() { + + var err error + HOME, err = homedir.Dir() + if err != nil { + log.Fatal(err) + } + + PATH = HOME + "/.config/serial-monitor/" + + if _, err := os.Stat(PATH); os.IsNotExist(err) { + // Directory does not exist, create it + err := os.MkdirAll(PATH, os.ModePerm) + if err != nil { + fmt.Println("Error creating directory:", err) + } else { + fmt.Println("Directory created:", PATH) + } + } +} diff --git a/serial_read/path_win.go b/serial_read/path_win.go new file mode 100644 index 0000000..621b36d --- /dev/null +++ b/serial_read/path_win.go @@ -0,0 +1,24 @@ +//go:build windows +// +build windows + +package main + +import ( + "github.com/mitchellh/go-homedir" + "log" +) + +var ( + HOME string + PATH string +) + +func init() { + var err error + HOME, err = homedir.Dir() + if err != nil { + log.Fatal(err) + } + + PATH = HOME + "\\Downloads" +}