The present code implements and checks the current temperature.
Fork of 2645_I2C_TMP102 by
Revision 3:5d33e4bd4433, committed 2016-05-11
- Comitter:
- bonnyngangu
- Date:
- Wed May 11 14:43:59 2016 +0000
- Parent:
- 2:0047b6c36b3e
- Commit message:
- Light pattern expressing hot and cold temperature.
Changed in this revision
main.h | Show diff for this revision Revisions of this file |
temp.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0047b6c36b3e -r 5d33e4bd4433 main.h --- a/main.h Mon May 09 09:17:29 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - Joystick_Project -Bonny Ngangu -6 March 2016 -(c) Bonny Ngangu, University of Leeds, Feb 2016 - -*/ - -#include "mbed.h" -// include the library header, ensure the library has been imported into the project -#include "TMP102.h" -#include "N5110.h" - - -// Create TMP102 object -TMP102 tmp102(I2C_SDA,I2C_SCL); -// UART connection for PC -Serial pc(USBTX,USBRX); - -// K64F on-board LEDs -DigitalOut r_led(LED_RED); -DigitalOut g_led(LED_GREEN); -DigitalOut b_led(LED_BLUE); - -// K64F on-board switches -InterruptIn sw2(SW2); -InterruptIn sw3(SW3); - -// error function hangs flashing an LED -void error(); -// setup serial port -void init_serial(); -// set-up the on-board LEDs and switches -void init_K64F(); -void printString(); - -void init_serial() { - // set to highest baud - ensure terminal software matches - pc.baud(115200); -} - -void init_K64F() -{ - // on-board LEDs are active-low, so set pin high to turn them off. - r_led = 1; - g_led = 1; - b_led = 1; - - // since the on-board switches have external pull-ups, we should disable the internal pull-down - // resistors that are enabled by default using InterruptIn - sw2.mode(PullNone); - sw3.mode(PullNone); -} \ No newline at end of file
diff -r 0047b6c36b3e -r 5d33e4bd4433 temp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/temp.h Wed May 11 14:43:59 2016 +0000 @@ -0,0 +1,53 @@ +/* + Joystick_Project +Bonny Ngangu +6 March 2016 +(c) Bonny Ngangu, University of Leeds, Feb 2016 + +*/ + +#include "mbed.h" +// include the library header, ensure the library has been imported into the project +#include "TMP102.h" +#include "N5110.h" + + +// Create TMP102 object +TMP102 tmp102(I2C_SDA,I2C_SCL); +// UART connection for PC +Serial pc(USBTX,USBRX); + +// K64F on-board LEDs +DigitalOut r_led(LED_RED); +DigitalOut g_led(LED_GREEN); +DigitalOut b_led(LED_BLUE); + +// K64F on-board switches +InterruptIn sw2(SW2); +InterruptIn sw3(SW3); + +// error function hangs flashing an LED +void error(); +// setup serial port +void init_serial(); +// set-up the on-board LEDs and switches +void init_K64F(); +void printString(); + +void init_serial() { + // set to highest baud - ensure terminal software matches + pc.baud(115200); +} + +void init_K64F() +{ + // on-board LEDs are active-low, so set pin high to turn them off. + r_led = 1; + g_led = 1; + b_led = 1; + + // since the on-board switches have external pull-ups, we should disable the internal pull-down + // resistors that are enabled by default using InterruptIn + sw2.mode(PullNone); + sw3.mode(PullNone); +} \ No newline at end of file