Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RP IT18229462
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rajasingam kokilan
RP IT18229462
Commits
e43d4fe3
Commit
e43d4fe3
authored
Apr 29, 2022
by
Rajasingam kokilan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
write
parent
f87ea92f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
write.py
write.py
+47
-0
No files found.
write.py
0 → 100644
View file @
e43d4fe3
import
matplotlib.pyplot
as
plt
import
matplotlib.animation
as
animation
import
time
import
RPi.GPIO
as
GPIO
def
ping
():
GPIO
.
setmode
(
GPIO
.
BCM
)
GPIO
.
setwarnings
(
False
)
trig_2
=
26
echo_2
=
19
while
True
:
# Echo
GPIO
.
setup
(
trig_2
,
GPIO
.
OUT
)
# Trigger
GPIO
.
setup
(
echo_2
,
GPIO
.
IN
)
GPIO
.
output
(
trig_2
,
False
)
time
.
sleep
(
1.5
)
GPIO
.
output
(
trig_2
,
True
)
time
.
sleep
(
0.001
)
GPIO
.
output
(
trig_2
,
False
)
start1
=
time
.
time
()
while
GPIO
.
input
(
echo_2
)
==
0
:
start1
=
time
.
time
()
while
GPIO
.
input
(
echo_2
)
==
1
:
stop1
=
time
.
time
()
elapsed1
=
stop1
-
start1
distancet1
=
(
elapsed1
*
34300
)
-
0.5
distance1
=
distancet1
/
2
elapsed1
=
round
(
elapsed1
,
6
)
distance1
=
round
(
distance1
,
0
)
y
=
str
(
distance1
)
x
=
str
(
elapsed1
)
if
distance1
<
5
:
print
(
"tank full open door"
)
elif
distance1
>
8
and
distance1
<
12
:
print
(
"Tank Is Approximately Half dont open door"
)
elif
distance1
>
18
and
distance1
<
21
:
print
(
"Tank Is Empty"
)
z
=
x
+
","
+
y
+
"
\n
"
print
(
z
)
file
=
'text.txt'
with
open
(
file
,
'a'
)
as
filetowrite
:
filetowrite
.
write
(
z
)
filetowrite
.
close
()
GPIO
.
cleanup
()
return
distance1
while
True
:
ping
()
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