1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

(雑)(3.3V)MCP9700の簡易計算法をためす。

Last updated at Posted at 2024-09-12

参考

o_coq392.jpg

x 過去ログを見よ!!
x UNOを一時的に3.3Vで動かす(危険)(危険)(危険)PCに繋ぐとPCが破壊されます。(いろいろした)
x Arduino UNOを一時的に3.3Vにします。

x 販売コード 114300 型番 MCP9700A-E/TO
x 販売コード 130012 型番 MCP9700T-E/TT
x 販売コード 109692 型番 MCP9700-E/TO

目的
ichgojamなんかで使われている
符号付整数の計算方法を試す。
最大で20程度ズレる、論理値2800
1024 x 32 / 10 - 500 = 2776

結果

o_coq393.jpg

o_coq391.jpg

プログラム




//MCP9700_SMD_3V3_zatu_UNO1


//初期化
void setup() {
  //シリアルポートの初期化
  Serial.begin(9600);
}//setup


//メインループ
void loop() {

  int sensorValue; //センサーの読み取り値
  int Temperature; //温度

  //温度センサーから値を読み込む
  sensorValue = analogRead(A0); //UNO

  //センサーの値から温度に変換 0℃に合わす為に500mVを引く
  //sensorValue = 469; //debug 約1.5V  100.0℃
  //sensorValue = 242; //debug 約0.8V   27.9℃(論理値)
  //sensorValue =   0; //debug 約0.0V  -50.0℃
  Temperature = sensorValue * 32 / 10 - 500;

  //結果の表示
  // print out the value you Temperature:
  Serial.print(Temperature / 10);
  Serial.print('.');
  Serial.print(Temperature % 10);
  Serial.println();
  delay(1000);        // delay in between reads for stability

}//loop



1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?