Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ege Meriç Erdoğan
rpi_myroom
Commits
2c887ec9
Unverified
Commit
2c887ec9
authored
5 years ago
by
test
Committed by
GitHub
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
changed veriables name
parent
c42b1964
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
button.py
+7
-6
button.py
with
7 additions
and
6 deletions
+7
-6
button.py
View file @
2c887ec9
...
...
@@ -9,27 +9,28 @@ def get_call(url):
response
=
requests
.
get
(
url
,
headers
=
headers
)
print
(
"Ok"
)
def
get_lock
():
Port_
=
2020
Server_
=
"10.1.1.2"
s
=
socket
.
socket
()
s
.
connect
((
'10.1.1.2'
,
12345
))
s
.
connect
((
Server_
,
Port_
))
str
=
"bye"
s
.
send
(
str
.
encode
());
res
=
s
.
recv
(
5
)
print
(
res
)
s
.
close
()
Button_Gpio_Pin
=
12
GPIO
.
setwarnings
(
False
)
GPIO
.
setmode
(
GPIO
.
BOARD
)
GPIO
.
setup
(
12
,
GPIO
.
IN
,
pull_up_down
=
GPIO
.
PUD_DOWN
)
GPIO
.
setup
(
Button_Gpio_Pin
,
GPIO
.
IN
,
pull_up_down
=
GPIO
.
PUD_DOWN
)
URL
=
"http://10.1.1.10:8080/relay/off.php"
URL2
=
"http://10.1.1.10:8080/relay/on.php"
while
True
:
if
GPIO
.
input
(
12
)
==
GPIO
.
HIGH
:
get_call
(
URL
)
(
URL
,
URL2
)
=
(
URL2
,
URL
)
(
URL
,
URL2
)
=
(
URL2
,
URL
)
#change the button status
time
.
sleep
(
2
)
if
URL2
==
"http://10.1.1.10:8080/relay/off.php"
:
st
=
1
#statement control
st
=
1
#statement control(off)
if
st
==
1
:
st
=
0
if
st
==
0
:
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help