-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
413d841
commit efb00ac
Showing
9 changed files
with
340 additions
and
82 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import sys | ||
import os | ||
import serial | ||
import threading | ||
import time | ||
|
||
|
||
def monitor(comport: str, baudrate: int): | ||
|
||
ser = serial.Serial(comport, baudrate, timeout=0) | ||
|
||
while (1): | ||
line = ser.readline() | ||
# print(line, type(line)) | ||
if (line != b''): | ||
# line = line.decode("ascii") | ||
line = line.decode() | ||
print(line) | ||
# print line[:-1] # strip \n | ||
# fields = line[:-1].split('; ') | ||
|
||
# ID = fields[0] | ||
# TIME = int(fields[1]) | ||
# print fields | ||
# print("device ID: ", ID) | ||
# write to file | ||
text_file = open("Pdata.log", "a") | ||
# line = str(TIME) + ": " + str(CT) + "\n" | ||
text_file.write(line) | ||
text_file.close() | ||
time.sleep(0.01) | ||
|
||
# do some other things here | ||
|
||
print("Stop Monitoring") | ||
|
||
|
||
if __name__ == "__main__": | ||
print("Start Serial Monitor") | ||
COMPORT = "COM9" | ||
BAUDRATE = 9600 | ||
monitor(COMPORT, BAUDRATE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// File: MyCharArrays.h | ||
|
||
#ifndef MY_MESSAGES_H | ||
#define MY_MESSAGES_H | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.