Hallo zusammen,
ich habe jetzt schon einige Stunden rumprobiert und komme nicht weiter. Habe mir im Internet folgenden Code rausgesucht:
// Experiment with time-controlled periodic transmission.
// Temperature and Humidity is sampled every 4 sec and transmitted
#import <WProgram.h>
#define NODE 25
#define GROUP 4
#include <Ports.h>
#include <RF12.h>
#include <Sensirion.h>
//pin definitions for the SDA & SCL pins
const uint8_t dataPin = 18;
const uint8_t clockPin = 19;
float temperature;
float humidity;
float dewpoint;
Sensirion tempSensor = Sensirion(dataPin, clockPin);
MilliTimer sendTimer;
byte pending;
word seqnum;
char buf[20]; /* main buffer for transmission */
char buf_tmp[10]; /* temporary buffer */
//prototypes
char *ftoa(char *a, double f, int precision);
void setup () {
pinMode(7, OUTPUT); /* led on pin 7 */
rf12_initialize(NODE, RF12_433MHZ, GROUP); /* initializing radio module */
}
void loop () {
tempSensor.measure(&temperature, &humidity, &dewpoint);
ftoa(buf, temperature, 2);
ftoa(buf_tmp, humidity,2);
strcat(buf, "C:");
strcat(buf,buf_tmp);
strcat(buf, "RH%:");
ftoa(buf_tmp, humidity,2);
strcat(buf,buf_tmp);
strcat(buf, "Dew");
if (rf12_recvDone() && rf12_crc == 0 && rf12_len == 2) {
sendTimer.set(0);
}
if (sendTimer.poll(4096))
pending = 1;
if (pending && rf12_canSend()) {
pending = 0;
digitalWrite(7, LOW);
//rf12_sendStart(RF12_HDR_ACK, "hello!", 6);
rf12_sendStart(RF12_HDR_ACK, buf, 20);
++seqnum;
digitalWrite(7, HIGH);
}
}
//this function is converting a float into a string
char *ftoa(char *a, double f, int precision)
{
long p[] = {0,10,100,1000,10000,100000,1000000,10000000,100000000};
char *ret = a;
long units = (long)f;
itoa(units, a, 10);
while (*a != '\0') a++;
*a++ = '.';
long decimal = abs((long)((f - units) * p[precision]));
itoa(decimal, a, 10);
return ret;
}
Nach dem Kompilieren erhalte ich folgende Fehlermeldungen:
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp: In constructor 'Sensirion::Sensirion(uint8_t, uint8_t)':
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:82: error: 'OUTPUT' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:82: error: 'pinMode' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp: In member function 'uint8_t Sensirion::meas(uint8_t, uint16_t*, bool)':
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:131: error: 'digitalRead' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:135: error: 'delay' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp: In member function 'uint8_t Sensirion::measRdy()':
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:147: error: 'digitalRead' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp: In member function 'uint8_t Sensirion::putByte(uint8_t)':
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:235: error: 'OUTPUT' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:235: error: 'pinMode' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:238: error: 'digitalWrite' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:239: error: 'delayMicroseconds' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:240: error: 'HIGH' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:242: error: 'LOW' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:246: error: 'INPUT' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:248: error: 'digitalWrite' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:250: error: 'HIGH' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:251: error: 'delayMicroseconds' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:252: error: 'digitalRead' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:255: error: 'LOW' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp: In member function 'uint8_t Sensirion::getByte(bool)':
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:265: error: 'HIGH' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:265: error: 'digitalWrite' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:266: error: 'delayMicroseconds' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:267: error: 'digitalRead' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:268: error: 'LOW' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:271: error: 'OUTPUT' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:271: error: 'pinMode' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:272: error: 'digitalWrite' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:273: error: 'delayMicroseconds' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:274: error: 'HIGH' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:276: error: 'LOW' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:278: error: 'INPUT' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp: In member function 'void Sensirion::startTransmission()':
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:298: error: 'HIGH' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:298: error: 'digitalWrite' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:299: error: 'OUTPUT' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:299: error: 'pinMode' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:300: error: 'delayMicroseconds' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:303: error: 'LOW' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp: In member function 'void Sensirion::resetConnection()':
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:325: error: 'HIGH' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:325: error: 'digitalWrite' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:326: error: 'OUTPUT' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:326: error: 'pinMode' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:327: error: 'delayMicroseconds' was not declared in this scope
C:\Users\David\Documents\Arduino\libraries\Sensirion\Sensirion.cpp:331: error: 'LOW' was not declared in this scope
Der Programmcode liegt unter:
C:\Benutzer\David\Eigene Dokumente\Arduino\Programme\Temp_Hum_Messung\Temp_Hum_Messung.ino
Die Libraries liegen unter:
C:\Benutzer\David\Eigene Dokumente\Arduino\libraries\jeelib
und
C:\Benutzer\David\Eigene Dokumente\Arduino\libraries\Sensirion
bzw. auch unter:
D:\Arduino\arduino-1.0.5\libraries
Ich habe diese auch über Sketch -> libraries importieren eingefügt, aber irgendwie bin ich mir nicht sicher, wo die hin müssen. Kann mir bitte jemand helfen. Google-Recherche brachte mich auch nicht wirklich weiter, außer dass ich noch anderen Code fand. Am Code dürfte es aber nicht liegen, da dieser ja kopiert ist.
Vielen Dank für eure Hilfe,
David