Cov txheej txheem:

Sib cuam tshuam TMP-112 Nrog Arduino Nano (I2C): 5 Kauj Ruam
Sib cuam tshuam TMP-112 Nrog Arduino Nano (I2C): 5 Kauj Ruam

Video: Sib cuam tshuam TMP-112 Nrog Arduino Nano (I2C): 5 Kauj Ruam

Video: Sib cuam tshuam TMP-112 Nrog Arduino Nano (I2C): 5 Kauj Ruam
Video: 【Full sub/lyrics】The world's first Pokemon Halloween Party@Universial Studio Japan 2024, Kaum ib hlis
Anonim
Sib cuam tshuam TMP-112 Nrog Arduino Nano (I2C)
Sib cuam tshuam TMP-112 Nrog Arduino Nano (I2C)

Nyob zoo, Nyob zoo os.. !!

Kuv (Somanshu Choudhary) sawv cev ntawm Dcube thev naus laus zis kev lag luam mus ntsuas qhov ntsuas kub siv Arduino nano, nws yog ib qho ntawm daim ntawv thov I2C raws tu qauv los nyeem cov ntaub ntawv sib piv ntawm qhov kub Sensor TMP-112.

Kauj ruam 1: Txheej txheem cej luam

Txheej txheem cej luam
Txheej txheem cej luam
  1. TMP-112 yog qhov ntsuas kub.
  2. DATASHEET Txuas:

Kauj ruam 2: Yam Koj Xav Tau / Txuas

Yam Koj Xav Tau / Txuas
Yam Koj Xav Tau / Txuas
  1. Arduino Nano Cov
  2. I²C Shield rau Arduino Nano
  3. USB Cable Hom A rau Micro Hom B 6 Taw Ntev
  4. I²C Kab
  5. TMP112 I²C Kub Sensor ±.5 ° C 12-ntsis I²C Mini Module

Kauj Ruam 3: Daim duab Circuit Court

Daim duab Circuit Court
Daim duab Circuit Court
Daim duab Circuit Court
Daim duab Circuit Court

Kauj ruam 4: Programming

Programming
Programming

#suav nrog

void teeb tsa ()

{

// I2C chaw nyob ntawm TMP112

#txhais TMP_ADDR 0x48

// Koom nrog I2c Bus li tus tswv

Hlau.begin ();

// Pib kev sib txuas lus

Serial.begin (9600);

// Pib kis

Wire.beginTransmission (TMP_ADDR);

// Xaiv ENABLE sau npe

Hlau.write (0x01);

// Xaiv ib txwm ua haujlwm

Hlau.write (0x60A0);

// Xaus kev kis thiab tso I2C npav

Wire.endTransmission ();

}

void lub voj ()

{

// Pib kis

Wire.beginTransmission (TMP_ADDR);

// Xaiv Cov Ntaub Ntawv Sau Npe

Hlau.write (0X00);

// Kawg Kis

Wire.endTransmission ();

ncua (500);

// Thov 2 bytes, Msb ua ntej

Wire.requestFrom (TMP_ADDR, 2);

// Nyeem ob lub bytes

thaum (Wire.available ())

{

// tshem cov khib nyiab

Serial.flush ();

int msb = Hlau.read ();

int lsb = Wire.read ();

Wire.endTransmission ();

// Cov ntaub ntawv hloov pauv hauv qhov tseem ceeb

int rawtmp = msb << 8 | lsb;

int tus nqi = rawtmp >> 4;

ob xyoos = tus nqi * 0.0625;

// Luam tawm

Serial.print ("tus nqi Celsius:");

Serial.println (ans);

}

}

Kauj ruam 5:

Kuv tau ua qhov zoo tshaj plaws ua koj li;-)

Yog xav paub ntxiv thov mus saib peb lub xaib:

www.dcubetechnologies.com

Pom zoo: