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.
Fork of IR_temperature by
main.cpp
00001 #include "mbed.h" 00002 #include "mlx90614.h" 00003 00004 DigitalOut myled(LED1),p31(P0_29),p32(P0_30),laser_mod(p21); //displays I2C wait 00005 DigitalIn tog_temp(p19),tog_gyro(p20); 00006 I2C i2c(p9,p10); //sda,scl 00007 Serial pc(USBTX,USBRX); //serial usb config 00008 00009 MLX90614 IR_thermometer(&i2c); 00010 //setup an MLX90614 using MLX90614 library from 00011 // http://mbed.org/users/aquahika/libraries/MLX90614/lsixz6 00012 00013 float temp; //temperature in degrees C 00014 00015 int main() { 00016 p31 = 0; 00017 p32 = 1; 00018 while (1) { 00019 if(tog_temp){ 00020 p31 = 0; 00021 p32 = 1; 00022 } 00023 else if(tog_gyro){ 00024 p31 = 1; 00025 p32 = 0; 00026 } 00027 00028 myled=1; // if led1 on - waiting on I2C 00029 if(p32 == 1){ 00030 00031 if (IR_thermometer.getTemp(&temp)) { 00032 //gets temperature from sensor via I2C bus 00033 myled=0; 00034 //print temperature on PC 00035 printf("Temperature is %5.1F degrees C\r\n",temp); 00036 } 00037 }else{ 00038 printf("Gyro"); 00039 } 00040 //wait for device to produce next temperature reading 00041 wait(0.5); 00042 } 00043 }
Generated on Sat Jul 16 2022 18:57:07 by
1.7.2
