-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4184a3
commit 4339146
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Linux hardware test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: self-hosted | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
- name: Install necessary tools | ||
run: | | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
sudo apt -y update | ||
sudo apt -y install i2c-tools | ||
pip3 install smbus | ||
- name: Build it | ||
run: | | ||
python3 test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from kellerLD import KellerLD | ||
import time | ||
|
||
sensor = KellerLD(4) | ||
|
||
if not sensor.init(): | ||
print("Failed to initialize Keller LD sensor!") | ||
exit(1) | ||
|
||
print("Testing Keller LD series pressure sensor") | ||
|
||
for i in range(10): | ||
try: | ||
sensor.read() | ||
print("pressure: %7.4f bar\ttemperature: %0.2f C" % (sensor.pressure(), sensor.temperature())) | ||
# we shouldn't get anything out of these values in the test hardware | ||
assert 5 < sensor.temperature() < 50 | ||
assert -1 < sensor.pressure() < 1 | ||
time.sleep(0.2) | ||
except Exception as e: | ||
print(e) |