Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HEV - High Energy Ventilator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projects
HEV - High Energy Ventilator
Commits
d84a044f
Commit
d84a044f
authored
4 years ago
by
Your Name
Browse files
Options
Downloads
Patches
Plain Diff
added trip switch/fuse status to battery
parent
8041f1bf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
battery/batt_test.py
+15
-6
15 additions, 6 deletions
battery/batt_test.py
with
15 additions
and
6 deletions
battery/batt_test.py
+
15
−
6
View file @
d84a044f
...
...
@@ -12,27 +12,36 @@
import
RPi.GPIO
as
gpio
from
time
import
sleep
import
datetime
pin_bat
=
5
pin_ok
=
6
pin_alarm
=
12
pin_rdy2buf
=
13
pin_bat85
=
19
pin_prob_elec
=
7
gpio
.
setmode
(
gpio
.
BCM
)
gpio
.
setup
(
pin_bat
,
gpio
.
IN
)
gpio
.
setup
(
pin_ok
,
gpio
.
IN
)
gpio
.
setup
(
pin_alarm
,
gpio
.
IN
)
gpio
.
setup
(
pin_rdy2buf
,
gpio
.
IN
)
gpio
.
setup
(
pin_bat85
,
gpio
.
IN
)
gpio
.
setup
(
pin_bat
,
gpio
.
IN
,
pull_up_down
=
gpio
.
PUD_DOWN
)
gpio
.
setup
(
pin_ok
,
gpio
.
IN
,
pull_up_down
=
gpio
.
PUD_DOWN
)
gpio
.
setup
(
pin_alarm
,
gpio
.
IN
,
pull_up_down
=
gpio
.
PUD_DOWN
)
gpio
.
setup
(
pin_rdy2buf
,
gpio
.
IN
,
pull_up_down
=
gpio
.
PUD_DOWN
)
gpio
.
setup
(
pin_bat85
,
gpio
.
IN
,
pull_up_down
=
gpio
.
PUD_DOWN
)
gpio
.
setup
(
pin_prob_elec
,
gpio
.
IN
,
pull_up_down
=
gpio
.
PUD_DOWN
)
log
=
open
(
'
batt.log
'
,
'
w
'
)
while
True
:
bat
=
gpio
.
input
(
pin_bat
)
ok
=
gpio
.
input
(
pin_ok
)
alarm
=
gpio
.
input
(
pin_alarm
)
rdy2buf
=
gpio
.
input
(
pin_rdy2buf
)
bat85
=
gpio
.
input
(
pin_bat85
)
prob_elec
=
gpio
.
input
(
pin_prob_elec
)
dt
=
datetime
.
datetime
.
now
()
print
(
f
"
BAT=
{
bat
}
OK=
{
ok
}
ALARM=
{
alarm
}
RDY2BUF=
{
rdy2buf
}
BAT>85=
{
bat85
}
"
)
print
(
f
"
{
dt
}
BAT=
{
bat
}
OK=
{
ok
}
ALARM=
{
alarm
}
RDY2BUF=
{
rdy2buf
}
BAT>85=
{
bat85
}
PROB_ELEC=
{
prob_elec
}
"
)
log
.
write
(
f
"
{
dt
}
BAT=
{
bat
}
OK=
{
ok
}
ALARM=
{
alarm
}
RDY2BUF=
{
rdy2buf
}
BAT>85=
{
bat85
}
PROB_ELEC=
{
prob_elec
}
\n
"
)
sleep
(
1
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment