The present code implements and checks the current temperature.

Dependencies:   TMP102 mbed

Dependents:   Squash_Project

Fork of 2645_I2C_TMP102 by Craig Evans

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers temp.h Source File

temp.h

00001 /* 
00002  Joystick_Project
00003 Bonny Ngangu
00004 6 March 2016
00005 (c) Bonny Ngangu, University of Leeds, Feb 2016
00006 
00007 */ 
00008 
00009 #include "mbed.h"
00010 // include the library header, ensure the library has been imported into the project
00011 #include "TMP102.h"
00012 #include "N5110.h"
00013 
00014 
00015 // Create TMP102 object
00016 TMP102 tmp102(I2C_SDA,I2C_SCL);  
00017 // UART connection for PC
00018 Serial pc(USBTX,USBRX);
00019 
00020 // K64F on-board LEDs 
00021 DigitalOut r_led(LED_RED);
00022 DigitalOut g_led(LED_GREEN);
00023 DigitalOut b_led(LED_BLUE);
00024 
00025 // K64F on-board switches
00026 InterruptIn sw2(SW2);
00027 InterruptIn sw3(SW3);
00028 
00029 // error function hangs flashing an LED
00030 void error();
00031 // setup serial port
00032 void init_serial();
00033 // set-up the on-board LEDs and switches
00034 void init_K64F();
00035 void printString();
00036 
00037 void init_serial() {
00038     // set to highest baud - ensure terminal software matches
00039     pc.baud(115200); 
00040 }
00041 
00042 void init_K64F() 
00043 {
00044     // on-board LEDs are active-low, so set pin high to turn them off.
00045     r_led = 1;
00046     g_led = 1;
00047     b_led = 1;   
00048     
00049     // since the on-board switches have external pull-ups, we should disable the internal pull-down
00050     // resistors that are enabled by default using InterruptIn
00051     sw2.mode(PullNone);
00052     sw3.mode(PullNone);
00053 }