Sam Grove
/
PRforSHT31A_PRO
Fork to update the library (team vs. user account)
main.cpp@1:b4e81def6f93, 2018-12-21 (annotated)
- Committer:
- sam_grove
- Date:
- Fri Dec 21 19:36:11 2018 +0000
- Revision:
- 1:b4e81def6f93
- Parent:
- 0:ec66ac9ea013
Update library to use the same one as posted on the components page
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ClosedCube | 0:ec66ac9ea013 | 1 | /* |
ClosedCube | 0:ec66ac9ea013 | 2 | SHT31-ARP-B Analog Humidity & Temperature Sensor Example Code |
ClosedCube | 0:ec66ac9ea013 | 3 | ClosedCube SHT31A-PRO breakout module |
ClosedCube | 0:ec66ac9ea013 | 4 | |
ClosedCube | 0:ec66ac9ea013 | 5 | License: This example code is in the public domain. |
ClosedCube | 0:ec66ac9ea013 | 6 | Date: 14-Sep-2015 |
ClosedCube | 0:ec66ac9ea013 | 7 | |
ClosedCube | 0:ec66ac9ea013 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
ClosedCube | 0:ec66ac9ea013 | 9 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
ClosedCube | 0:ec66ac9ea013 | 10 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
ClosedCube | 0:ec66ac9ea013 | 11 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
ClosedCube | 0:ec66ac9ea013 | 12 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ClosedCube | 0:ec66ac9ea013 | 13 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE |
ClosedCube | 0:ec66ac9ea013 | 14 | */ |
ClosedCube | 0:ec66ac9ea013 | 15 | |
ClosedCube | 0:ec66ac9ea013 | 16 | #include "mbed.h" |
ClosedCube | 0:ec66ac9ea013 | 17 | #include "SHT3XA.h" |
ClosedCube | 0:ec66ac9ea013 | 18 | |
ClosedCube | 0:ec66ac9ea013 | 19 | /* |
ClosedCube | 0:ec66ac9ea013 | 20 | Hardware connections: |
ClosedCube | 0:ec66ac9ea013 | 21 | VDD to 3.3V |
ClosedCube | 0:ec66ac9ea013 | 22 | RH to A0 |
ClosedCube | 0:ec66ac9ea013 | 23 | T to A1 |
ClosedCube | 0:ec66ac9ea013 | 24 | GND to GND |
ClosedCube | 0:ec66ac9ea013 | 25 | */ |
ClosedCube | 0:ec66ac9ea013 | 26 | SHT3XA sht31a(A0,A1); |
ClosedCube | 0:ec66ac9ea013 | 27 | |
ClosedCube | 0:ec66ac9ea013 | 28 | Serial pc(USBTX, USBRX); |
ClosedCube | 0:ec66ac9ea013 | 29 | |
ClosedCube | 0:ec66ac9ea013 | 30 | int main() { |
ClosedCube | 0:ec66ac9ea013 | 31 | pc.baud(115200); |
ClosedCube | 0:ec66ac9ea013 | 32 | pc.printf("ClosedCube SHT31A-PRO example"); |
ClosedCube | 0:ec66ac9ea013 | 33 | |
ClosedCube | 0:ec66ac9ea013 | 34 | while( true ) { |
ClosedCube | 0:ec66ac9ea013 | 35 | pc.printf("T: %3.2fC RH: %3.2f%%\n", sht31a.readTempC(), sht31a.readRH()); |
ClosedCube | 0:ec66ac9ea013 | 36 | wait(0.3f); |
ClosedCube | 0:ec66ac9ea013 | 37 | } |
ClosedCube | 0:ec66ac9ea013 | 38 | |
ClosedCube | 0:ec66ac9ea013 | 39 | } |