라즈베리파이 SHT30 드라이버 측정 명령을 0x2C06(clock stretching ENABLED, 주석은 "비활성"이라 모순)에서 0x2400(clock stretching DISABLED)으로 교정. 드라이버의 write→대기→read 접근 패턴 및 Pi BCM I2C 클럭스트레치 버그와 정합하며, 벤더 예제 ArtronShop_SHT3x(P4422-2)의 무-스트레치 방식과 일치. CRC-8 검증은 유지(벤더 예제는 생략). 변환식·주소(0x44)·프레임 동일. STM32 펌웨어는 0x2C06 유지(HAL 스트레치 지원). - P4422-2/: 벤더 SHT3x 아두이노 예제(ArtronShop_SHT3x) 벤더링 - 서명/서버 프로토콜 무영향. 현장 하드웨어 실측 검증 필요(시뮬은 명령 무관)
29 lines
604 B
C++
29 lines
604 B
C++
#include <Arduino.h>
|
|
#include <Wire.h>
|
|
#include <ArtronShop_SHT3x.h>
|
|
|
|
ArtronShop_SHT3x sht3x(0x44, &Wire); // ADDR: 0 => 0x44, ADDR: 1 => 0x45
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
|
|
Wire.begin();
|
|
while (!sht3x.begin()) {
|
|
Serial.println("SHT3x not found !");
|
|
delay(1000);
|
|
}
|
|
}
|
|
|
|
void loop() {
|
|
if (sht3x.measure()) {
|
|
Serial.print("Temperature: ");
|
|
Serial.print(sht3x.temperature(), 1);
|
|
Serial.print(" *C\tHumidity: ");
|
|
Serial.print(sht3x.humidity(), 1);
|
|
Serial.print(" %RH");
|
|
Serial.println();
|
|
} else {
|
|
Serial.println("SHT3x read error");
|
|
}
|
|
delay(1000);
|
|
}
|