//Uses all the sensors to update all of the global variables that have to do with logging. int update_data() { p_sensor.Barometer_MS5803(); //Gathers data from external temp/pressure sensor //Updates temperatures, pressure, and power pressure = p_sensor.MS5803_Pressure(); external_temp = p_sensor.MS5803_Temperature(); internal_temp = temperature.read(); power = ain.read(); //Data gathered from GPS bool gps_ready = gps_readable(); int max_gps_requests = 4; int gps_counter = 0; while (!gps_ready && gps_counter < max_gps_requests) { gps_ready = gps_readable(); gps_counter++; //printf("Waiting!\n"); } if (gps_ready) { update_lat_long(); altitude = gps.f_altitude(); precision = gps.hdop(); gps.stats(&encoded_chars, &good_sentences, &failed_checksums); update_datetime(); } else { //Place DUMMY GPS VALUES latitude = -1000.0; longitude = -1000.0; altitude = -1000.0; precision = -1000; sprintf(date,"20000 BC"); encoded_chars = -1; good_sentences = -1; failed_checksums = -1; } return 0; //Data update was a success! }
int main() { float t = temperature.read(); printf("TMP102: Temperature: %f\n\r", t); // In our test environment (ARM office) we should get a temperature within // the range ]15, 30[C bool result = (t > 15.0) && (t < 30.0); notify_completion(result); }
int main() { MBED_HOSTTEST_TIMEOUT(10); MBED_HOSTTEST_SELECT(default_auto); MBED_HOSTTEST_DESCRIPTION(DigitalIn DigitalOut); MBED_HOSTTEST_START("MBED_A4"); float t = temperature.read(); printf("TMP102: Temperature: %f\n\r", t); // In our test environment (ARM office) we should get a temperature within // the range ]15, 30[C bool result = (t > 15.0) && (t < 30.0); MBED_HOSTTEST_RESULT(result); }