File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Linux hardware test
2+
3+ on : [push, pull_request]
4+
5+ jobs :
6+ build :
7+
8+ runs-on : self-hosted
9+
10+ steps :
11+ - uses : actions/checkout@master
12+ - name : Install necessary tools
13+ run : |
14+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
15+ sudo apt -y update
16+ sudo apt -y install i2c-tools python3-smbus
17+ - name : Build it
18+ run : |
19+ python3 test.py
Original file line number Diff line number Diff line change 1+ from kellerLD import KellerLD
2+ import time
3+
4+ sensor = KellerLD (4 )
5+
6+ if not sensor .init ():
7+ print ("Failed to initialize Keller LD sensor!" )
8+ exit (1 )
9+
10+ print ("Testing Keller LD series pressure sensor" )
11+
12+ for i in range (10 ):
13+ try :
14+ sensor .read ()
15+ print ("pressure: %7.4f bar\t temperature: %0.2f C" % (sensor .pressure (), sensor .temperature ()))
16+ # we shouldn't get anything out of these values in the test hardware
17+ assert 5 < sensor .temperature () < 50
18+ assert - 1 < sensor .pressure () < 1
19+ time .sleep (0.2 )
20+ except Exception as e :
21+ print (e )
You can’t perform that action at this time.
0 commit comments