Hello.
I ran into a dead end for a n00b. I have a mcu-96015 IR temperature sensor, with serial interface (rx&tx pins) and would want to use it on the arduino, displaying the temperature on a 16x2 lcd (interfaced through i2c).
Sensor reading works good on serial monitor, the lcd display works well for other projects, but i don't know how to put these three together. I was hoping you guys know more than i do, so i will attach the sketch i use for displaying temperature on the serial monitor.
/********************************
Conexiuni:
Senzor VCC -> Arduino 5V
Senzor GND -> Arduino GND
Senzor Rx -> Arduino 11
Senzor Tx -> Arduino 10
Serial port:
Set serial monitor baud rate to 57600
********************************/
#include<SoftwareSerial.h>
SoftwareSerial mySerial(10,11);
unsigned char output[9];
unsigned char need[2];
void setup()
{
Serial.begin(57600);
while(!Serial){
;
}
mySerial.begin(115200);
mySerial.write(0xA5);
mySerial.write(0x45);
mySerial.write(0xEA);
}
void loop()
{
if(mySerial.available()){
Serial.print("Taking Readings");
for(int counter=0;counter<=8;counter++){
output[counter] = (unsigned char)mySerial.read();
Serial.print(".");
}
for(int obj=0;obj<=8;obj++){
if(output[obj]==0x5A){
need[0] = output[obj+4];
need[1] = output[obj+5];
float temp = (float)(need[0] << 8 | need[1])/100;
Serial.println();
Serial.println("Temperature is: ");
Serial.println(temp);
obj = 8;
}
else{//No need to do anything}
}
delay(500);
}
}
}