Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
Osso
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
Osso
Commits
4ab10977
Commit
4ab10977
authored
Apr 16, 2014
by
nextime
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/unixmedia/Osso
parents
05fbbf85
0e697cd4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
README.md
README.md
+3
-0
ossotest.py
ossotest.py
+89
-0
No files found.
README.md
View file @
4ab10977
...
@@ -12,6 +12,9 @@ from usb or power connector on the beaglebone! )
...
@@ -12,6 +12,9 @@ from usb or power connector on the beaglebone! )
The size of the cape is a standard format for 9 units DIN mount boxes.
The size of the cape is a standard format for 9 units DIN mount boxes.
Test Debian GNU/Linux install available: take a look at
https://github.com/unixmedia/Osso/wiki/Osso-Test-Installation
For more infos:
For more infos:
http://www.unixmedia.it/en/domotika/schede-di-espansione-prototipazione/osso-beaglebone-io-expansion-board
http://www.unixmedia.it/en/domotika/schede-di-espansione-prototipazione/osso-beaglebone-io-expansion-board
...
...
ossotest.py
0 → 100644
View file @
4ab10977
#!/usr/bin/env python
"""
OSSO test script.
To run this you need to install devicetree support for
Osso board from https://github.com/unixmedia/Osso
and Adafruit I/O library for beaglebone
from https://github.com/adafruit/adafruit-beaglebone-io-python
(and, of course, python!)
"""
import
sys
,
time
import
Adafruit_BBIO.GPIO
as
GPIO
INPUTS
=
{
1
:
'P8_15'
,
2
:
'P8_11'
,
3
:
'P8_14'
,
4
:
'P8_12'
,
5
:
'P8_16'
,
6
:
'P8_17'
,
7
:
'P8_17'
,
8
:
'P8_26'
}
RELAYS
=
{
1
:
'P9_12'
,
2
:
'P9_15'
,
3
:
'P9_23'
,
4
:
'P8_9'
,
5
:
'P9_27'
,
6
:
'P9_41'
,
7
:
'P8_7'
,
8
:
'P9_42'
}
def
printhelp
():
print
"Usage:"
,
sys
.
argv
[
0
],
"<input|relay>"
print
print
"Example:"
print
print
sys
.
argv
[
0
],
"input 3"
print
print
sys
.
argv
[
0
],
"relay 2"
print
def
initialize
():
for
i
in
INPUTS
.
values
():
GPIO
.
setup
(
i
,
GPIO
.
IN
)
for
i
in
RELAYS
.
values
():
GPIO
.
setup
(
i
,
GPIO
.
OUT
)
def
relay
(
rel
):
GPIO
.
output
(
RELAYS
[
rel
],
GPIO
.
HIGH
)
print
'RELAY'
,
rel
,
'IS NOW ON (ctrl+C to exit, on exit any relay will be switched off)'
while
1
:
time
.
sleep
(
1
)
def
digitalinp
(
inp
):
print
'INPUT'
,
inp
,
'IS'
,
'open'
if
GPIO
.
input
(
INPUTS
[
inp
])
else
'close'
print
print
'Waiting for a state change... (or ctrl+C to exit)'
GPIO
.
wait_for_edge
(
INPUTS
[
inp
],
GPIO
.
BOTH
)
time
.
sleep
(
.01
)
# Adafruit library needs a little time to detect right status
print
'INPUT'
,
inp
,
'IS NOW'
,
'open'
if
GPIO
.
input
(
INPUTS
[
inp
])
else
'close'
def
custom_excepthook
(
type
,
value
,
traceback
):
if
type
is
KeyboardInterrupt
:
print
'Exit.'
return
# do nothing
else
:
sys
.
__excepthook__
(
type
,
value
,
traceback
)
sys
.
excepthook
=
custom_excepthook
if
__name__
==
'__main__'
:
try
:
if
(
len
(
sys
.
argv
)
>=
3
and
sys
.
argv
[
1
]
==
'relay'
and
int
(
sys
.
argv
[
2
])
in
range
(
1
,
9
)):
initialize
()
relay
(
int
(
sys
.
argv
[
2
]))
sys
.
exit
(
0
)
elif
(
len
(
sys
.
argv
)
>=
3
and
sys
.
argv
[
1
]
==
'input'
and
int
(
sys
.
argv
[
2
])
in
range
(
1
,
9
)):
initialize
()
digitalinp
(
int
(
sys
.
argv
[
2
]))
sys
.
exit
(
0
)
except
KeyboardInterrupt
:
sys
.
exit
(
0
)
printhelp
()
sys
.
exit
(
1
)
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