Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ADXL345_I2C Si114x Si7020 mbed
main.cpp
00001 /* Mpression Uzuki sensor shield test program 00002 * Copyright (c) 2016 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 * Mpression Uzuki sensor shield test program 00017 * 00018 * @author Toyomasa Watarai 00019 * @version 1.0 00020 * @date 3-March-2016 00021 * 00022 * http://www.m-pression.com/ja/solutions/boards/uzuki-shield?p_auth=P2omuceK&p_p_id=82&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&_82_struts_action=%2Flanguage%2Fview&languageId=en_US 00023 * 00024 * ADXL345 : Accelerometer 00025 * Si7013 : Temperature & Humidity Sensor 00026 * Si1145 : Proximity, Luminescence & UV Level Sensor 00027 * 00028 */ 00029 00030 #include "mbed.h" 00031 #include "ADXL345_I2C.h" 00032 #include "Si7020.h" 00033 #include "Si114x.h" 00034 00035 Serial pc(USBTX, USBRX); 00036 ADXL345_I2C adxl345(A4, A5); 00037 Si7020 si7013(A4, A5); 00038 Si114x si1145(A4, A5); 00039 00040 int main() { 00041 int buf[3]; 00042 float humid, temp; 00043 float uv; 00044 00045 adxl345.setPowerControl(0x00); 00046 adxl345.setDataFormatControl(0x0B); 00047 adxl345.setDataRate(ADXL345_3200HZ); 00048 adxl345.setPowerControl(0x08); 00049 00050 while(si1145.verifyConnection() != 1); 00051 00052 while(1) { 00053 adxl345.getOutput(buf); 00054 pc.printf("ax: %-5d, ay: %-5d, az: %-5d\n", (int16_t)buf[0], (int16_t)buf[1], (int16_t)buf[2]); 00055 00056 si7013.getHumidity(&humid); 00057 si7013.getTemperature(&temp); 00058 pc.printf("Humidity: %6.2f%%, Temperature: %6.2fC\n", humid, temp); 00059 00060 uv = (float)si1145.getUVIndex()/100; 00061 pc.printf("Vis: %d, IR: %d, UV: %6.3f\n", si1145.getVisibleLight(), si1145.getIRLight(), uv); 00062 00063 pc.printf("\n"); 00064 wait(1); 00065 } 00066 }
Generated on Wed Jul 13 2022 23:18:57 by
1.7.2
Uzuki sensor shield