Sensirion SHT75
-
Tim
- Vereinsvorstand

- Beiträge: 936
- Registriert: 05.04.2013 16:22
- Wohnort: Schleswig-Holstein
Sensirion SHT75
Weiß jemand von euch möglicherweise wie ich den http://www.sensirion.com/de/produkte/fe ... sor-sht75/ über einen Arduino(möglicherweise später Raspberry Pi) auslesen kann. Sämtliche Beispielcodes die ich bisher gefunden habe, funktionieren bei mir leider nicht oder ich bin zu blöd sie anzupassen. 
-
Tim
- Vereinsvorstand

- Beiträge: 936
- Registriert: 05.04.2013 16:22
- Wohnort: Schleswig-Holstein
Re: Sensirion SHT75
Den folgenden Code verwende ich bei mit der Arduino Software 1.0.5. Die benötigte Libary "Sensirion.h" habe ich eingefügt und sie wird bei den Libarys auch angezeigt.
Dann erhalte ich folgenden Fehler. Weiß jemand wie ich das beheben kann?/*
* Example code for SHT1x or SHT7x sensors demonstrating blocking calls
* for temperature and humidity measurement in the setup routine and
* non-blocking calls in the main loop. The pin 13 LED is flashed as a
* background task while temperature and humidity measurements are made.
*/
#include <Sensirion.h>
const uint8_t dataPin = 9; // SHT serial data
const uint8_t sclkPin = 8; // SHT serial clock
const uint8_t ledPin = 13; // Arduino built-in LED
const uint32_t TRHSTEP = 5000UL; // Sensor query period
const uint32_t BLINKSTEP = 250UL; // LED blink period
Sensirion sht = Sensirion(dataPin, sclkPin);
uint16_t rawData;
float temperature;
float humidity;
float dewpoint;
byte ledState = 0;
byte measActive = false;
byte measType = TEMP;
unsigned long trhMillis = 0; // Time interval tracking
unsigned long blinkMillis = 0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
delay(15); // Wait >= 11 ms before first cmd
// Demonstrate blocking calls
sht.measTemp(&rawData); // sht.meas(TEMP, &rawData, BLOCK)
temperature = sht.calcTemp(rawData);
sht.measHumi(&rawData); // sht.meas(HUMI, &rawData, BLOCK)
humidity = sht.calcHumi(rawData, temperature);
dewpoint = sht.calcDewpoint(humidity, temperature);
logData();
}
void loop() {
unsigned long curMillis = millis(); // Get current time
// Rapidly blink LED. Blocking calls take too long to allow this.
if (curMillis - blinkMillis >= BLINKSTEP) { // Time to toggle the LED state?
ledState ^= 1;
digitalWrite(ledPin, ledState);
blinkMillis = curMillis;
}
// Demonstrate non-blocking calls
if (curMillis - trhMillis >= TRHSTEP) { // Time for new measurements?
measActive = true;
measType = TEMP;
sht.meas(TEMP, &rawData, NONBLOCK); // Start temp measurement
trhMillis = curMillis;
}
if (measActive && sht.measRdy()) { // Note: no error checking
if (measType == TEMP) { // Process temp or humi?
measType = HUMI;
temperature = sht.calcTemp(rawData); // Convert raw sensor data
sht.meas(HUMI, &rawData, NONBLOCK); // Start humidity measurement
} else {
measActive = false;
humidity = sht.calcHumi(rawData, temperature); // Convert raw sensor data
dewpoint = sht.calcDewpoint(humidity, temperature);
logData();
}
}
}
void logData() {
Serial.print("Temperature = "); Serial.print(temperature);
Serial.print(" C, Humidity = "); Serial.print(humidity);
Serial.print(" %, Dewpoint = "); Serial.print(dewpoint);
Serial.println(" C");
}
Sensirion_SHT75:17: error: 'Sensirion' does not name a type
Sensirion_SHT75:26: error: 'TEMP' was not declared in this scope
Sensirion_SHT75.ino: In function 'void setup()':
Sensirion_SHT75:36: error: 'sht' was not declared in this scope
Sensirion_SHT75.ino: In function 'void loop()':
Sensirion_SHT75:57: error: 'TEMP' was not declared in this scope
Sensirion_SHT75:58: error: 'sht' was not declared in this scope
Sensirion_SHT75:58: error: 'NONBLOCK' was not declared in this scope
Sensirion_SHT75:61: error: 'sht' was not declared in this scope
Sensirion_SHT75:62: error: 'TEMP' was not declared in this scope
Sensirion_SHT75:63: error: 'HUMI' was not declared in this scope
Sensirion_SHT75:65: error: 'NONBLOCK' was not declared in this scope
-
ChristianB
- Admin

- Beiträge: 1920
- Registriert: 23.02.2010 22:12
Re: Sensirion SHT75
Das sieht aus als wenn die Bibliothek beim linken nicht eingebunden ist. Wie lautet denn das Übersetzungskommando. Bez. welcher Übersetzer kommt hier zum Einsatz? gcc?
-
Tim
- Vereinsvorstand

- Beiträge: 936
- Registriert: 05.04.2013 16:22
- Wohnort: Schleswig-Holstein
Re: Sensirion SHT75
Die Bibliothek war nicht (richtig) eingebunden, obwohl sie unter Sketch-->Librarys angezeigt wurde. Mit Klick auf die Library wurde aber nur eine Leerzeile und nicht "#include "Sensiro.h"" eingefügt.