Skip to content

Commit

Permalink
Add MLX90614 Test Code
Browse files Browse the repository at this point in the history
  • Loading branch information
Punuy authored Dec 17, 2022
1 parent 3d139f5 commit bb0a002
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions MLX90614_Buzzer (Thai)/MLX90614_Test.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <Wire.h>
#include "MLX90614.h"

esl::MLX90614 mlx90614;

void setup() {
Serial.begin(115200);
while (!Serial) ; // for Leonardo or Pro Micro
Wire.begin();
mlx90614.init( );
Serial.print( "Address = 0x" );
Serial.println( mlx90614.readSlaveAddress(), HEX );
}

void loop() {
float f;
Serial.print( "อุณหภูมิโดยรอบ. (Ta): " );
f = mlx90614.readAmbientTemperature(); // อุณหภูมิโดยรอบ
if ( !mlx90614.is_crc_error() ) {
Serial.println(f);
}
Serial.print( "อุณหภูมิวัตถุ. (To): " );
f = mlx90614.readObjectTemperature(); // อุณหภูมิวัตถุ
if ( !mlx90614.is_crc_error() ) {
Serial.println(f);
}
delay(1000); // อัพเดตทุกๆ 1วิ (1000 = 1วินาที)
}

0 comments on commit bb0a002

Please sign in to comment.