Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pedro Henrique Kopper
SADAPMAP
Commits
74d75898
Commit
74d75898
authored
Nov 16, 2017
by
Alisson Claudino
Browse files
Implementada pausa na amostragem
parent
53e4a20a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Firmware/ADS1115.ino/ADS1115.ino.ino
View file @
74d75898
...
...
@@ -21,16 +21,16 @@ void loop(void)
{
adc0
=
ads0
.
readADC_SingleEnded
(
0
);
adc1
=
ads0
.
readADC_SingleEnded
(
1
);
adc2
=
ads0
.
readADC_SingleEnded
(
2
);
/*
adc2 = ads0.readADC_SingleEnded(2);
adc3 = ads0.readADC_SingleEnded(3);
adc4 = ads1.readADC_SingleEnded(0);
adc5 = ads1.readADC_SingleEnded(1);
adc6 = ads1.readADC_SingleEnded(2);
adc7
=
ads1
.
readADC_SingleEnded
(
3
);
adc7 = ads1.readADC_SingleEnded(3);
*/
Serial
.
print
(
adc0
);
Serial
.
print
(
" "
);
Serial
.
print
(
adc1
);
Serial
.
print
(
" "
);
/*
Serial.print(" ");
Serial.print(adc2);
Serial.print(" ");
Serial.print(adc3);
...
...
@@ -43,7 +43,7 @@ void loop(void)
Serial.print(" ");
Serial.print(adc7);
Serial.print(" ");
Serial
.
print
(
millis
());
Serial.print(millis());
*/
Serial
.
print
(
"
\n
"
);
while
(
millis
()
%
100
!=
0
);
...
...
Interface/CalibracaoP.py
View file @
74d75898
...
...
@@ -316,4 +316,5 @@ class Ui_MainWindow(object):
for
i
in
range
(
0
,
len
(
seriaList
)):
self
.
usb
.
append
(
QtWidgets
.
QAction
(
self
.
MainWindow
))
self
.
usb
[
i
].
setText
(
seriaList
[
i
].
device
)
self
.
usb
[
i
].
setCheckable
(
True
)
self
.
menuPorta
.
addAction
(
self
.
usb
[
i
])
\ No newline at end of file
Interface/Graph.py
View file @
74d75898
...
...
@@ -27,7 +27,7 @@ class Graph(pyqtgraph.GraphicsLayout):
def
updateGraph
(
self
,
y1
,
y2
):
print
(
time
.
time
()
-
self
.
timeant
)
#
print(time.time()-self.timeant)
self
.
y1
.
append
(
y1
)
self
.
y2
.
append
(
y2
)
if
len
(
self
.
y1
)
>
self
.
x_range
+
1
:
...
...
@@ -50,6 +50,7 @@ class Graph(pyqtgraph.GraphicsLayout):
if
(
y_range
==
0
):
y_range
=
1
self
.
x_range
=
x_range
self
.
y_range
=
y_range
self
.
x1
=
[]
...
...
Interface/Main.py
View file @
74d75898
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
# importação de classes
import
pyqtgraph
import
serial
import
serial.tools.list_ports
import
time
import
sys
from
SerialManager
import
SerialManager
from
CalibracaoP
import
Ui_MainWindow
from
SystemEngine
import
SystemEngine
from
Graph
import
Graph
if
__name__
==
'__main__'
:
engine
=
SystemEngine
()
timer
=
QtCore
.
QTimer
()
#
timer
.
timeout
.
connect
(
engine
.
updateData
)
#
...
...
Interface/SerialManager.py
View file @
74d75898
import
serial
import
serial.tools.list_ports
import
time
class
SerialManager
(
object
):
def
__init__
(
self
):
self
.
portList
=
serial
.
tools
.
list_ports
.
comports
()
self
.
portNum
=
len
(
self
.
portList
)
...
...
Interface/SystemEngine.py
View file @
74d75898
...
...
@@ -14,8 +14,7 @@ class SystemEngine(object):
self
.
app
=
QtWidgets
.
QApplication
(
sys
.
argv
)
self
.
dialog
=
QtWidgets
.
QMainWindow
()
self
.
ser1
=
SerialManager
()
print
(
self
.
ser1
.
portList
[
0
])
self
.
ser1
.
startPort
(
str
(
self
.
ser1
.
portList
[
1
].
device
),
115200
)
self
.
ser1
.
startPort
(
str
(
self
.
ser1
.
portList
[
0
].
device
),
115200
)
self
.
uiCalibra1
=
Ui_MainWindow
()
self
.
uiCalibra1
.
setupUi
(
self
.
dialog
)
self
.
uiCalibra1
.
serialListPanel
(
self
.
ser1
.
portList
)
...
...
@@ -28,13 +27,28 @@ class SystemEngine(object):
self
.
x_scale
=
100
def
updateData
(
self
):
readData
=
self
.
ser1
.
read
()
# Lê o dado da serial
readData
=
readData
.
decode
(
'utf8'
)
dado
=
readData
.
split
(
' '
,
8
)
self
.
x_scale
=
int
(
self
.
uiCalibra1
.
t_max
.
text
())
if
(
self
.
x_scale
!=
self
.
prev_x_scale
):
self
.
layout
.
setGraphScale
(
int
(
self
.
x_scale
),
32700
)
self
.
prev_x_scale
=
self
.
x_scale
self
.
layout
.
updateGraph
(
float
(
dado
[
0
]),
float
(
dado
[
1
]))
\ No newline at end of file
if
(
self
.
uiCalibra1
.
usb
[
0
].
isChecked
()
==
True
):
readData
=
self
.
ser1
.
read
()
# Lê o dado da serial
readData
=
readData
.
decode
(
'utf8'
)
dado
=
readData
.
split
(
' '
,
3
)
print
(
dado
)
try
:
self
.
x_scale
=
int
(
self
.
uiCalibra1
.
t_max
.
text
())
except
ValueError
:
self
.
x_scale
=
100
if
(
self
.
x_scale
!=
self
.
prev_x_scale
):
try
:
self
.
layout
.
setGraphScale
(
int
(
self
.
x_scale
),
32700
)
except
:
print
(
"Err0r"
)
self
.
prev_x_scale
=
self
.
x_scale
self
.
uiCalibra1
.
forcaLabel
.
setText
(
str
(
dado
[
0
])
+
" Tonf"
)
self
.
uiCalibra1
.
calibranteLabel
.
setText
(
str
(
dado
[
1
].
split
()[
0
])
+
" mV"
)
self
.
layout
.
updateGraph
(
float
(
dado
[
0
]),
float
(
dado
[
1
]))
else
:
pass
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment