Kann da mal jemand über diesen Sketch schauen?

Hallo,
habe da folgendes Script bekomme allerdings immer eine Fehlermeldung könnte da mal jemand von euch Experten schauen wo da der Fehler liegt?

//#define PLUGIN_ID 43
//#define PLUGIN_NAME "LaCrosse"

//#define LACROSSE_TERM_PULSECOUNT 44*2
//#define LACROSSE_RAIN_PULSECOUNT 44*2
//#define LACROSSE_PULSECOUNT 44*2
//#define LACROSSE_MIN_PULSECOUNT 38*2

uint8_t Plugin_043_ProtocolCRC( uint8_t *addr, uint8_t len);
byte Plugin_043_ProtocolCheckID(byte checkID);

byte Plugin_043_ProtocolValidID[5];
byte Plugin_043_ProtocolVar[5];

void setup() {

  //  pinMode(led,OUTPUT);
  // pinMode(tx, OUTPUT);
}

boolean Plugin_043(byte function, struct NodoEventStruct *event, char *string)
{
  boolean success = false;

  switch (function)
  {
#ifdef PLUGIN_043_CORE
    case PLUGIN_RAWSIGNAL_IN:
      {
        if (RawSignal.Number != LACROSSE_PULSECOUNT) return false;
        byte basevar = 0;
        unsigned long bitstream1 = 0;                 // holds first 10 bits
        unsigned long bitstream2 = 0;                 // holds last 26 bits

        int temperature = 0;
        int humidity = 0;
        byte checksum = 0;
        byte data[10];
        byte parity = 0;
        byte bitcounter = 0;                          // counts number of received bits (converted from pulses)
        //==================================================================================
        // get bytes
        for (byte x = 1; x < RawSignal.Number; x += 2) {
          if (RawSignal.Pulses[x]*RawSignal.Multiply > 750) {
            if (bitcounter < 16) {
              bitstream1 = (bitstream1 << 1);
              bitcounter++;                     // only need to count the first 10 bits
            } else {
              bitstream2 = (bitstream2 << 1);
            }
          } else {
            if (bitcounter < 16) {
              bitstream1 = (bitstream1 << 1) | 0x1;
              bitcounter++;                     // only need to count the first 10 bits
            } else {
              bitstream2 = (bitstream2 << 1) | 0x1;
            }
          }
        }
        //==================================================================================
        // all bytes received, make sure checksum is okay
        //==================================================================================
        data[0] = (bitstream1 >> 12) & 0x0f;  // prepare nibbles from bit stream
        data[1] = (bitstream1 >>  8) & 0x0f;
        data[2] = (bitstream1 >>  4) & 0x0f;
        data[3] = (bitstream1 >>  0) & 0x0f;
        data[4] = (bitstream2 >> 24) & 0x0f;
        data[5] = (bitstream2 >> 20) & 0x0f;
        data[6] = (bitstream2 >> 16) & 0x0f;
        data[7] = (bitstream2 >> 12) & 0x0f;
        data[8] = (bitstream2 >>  8) & 0x0f;
        data[9] = (bitstream2 >>  4) & 0x0f;
        //==================================================================================
        parity = data[4] & 1; // no check of parity for now
        // first perform a checksum check to make sure the packet is a valid mebus packet
        for (byte i = 0; i < 10; i++) {
          checksum = checksum + data[i];
        }
        checksum = checksum & 0x0f;
        if (checksum != (bitstream2 & 0x0f )) return false;
        //==================================================================================
        // now process the various sensor types
        //==================================================================================

        void loop() {
          int i;

          Serial.print(F("LaCrosse : "));
          if (data[2] == 0) {
            Serial.print(F("Temperature = "));
            temperature = data[5] * 100;
            temperature = temperature + data[6] * 10;
            temperature = temperature + data[7];
            temperature = temperature - 500;
            Serial.println( (float)temperature / 10 );
          }
          if (data[2] == 0x0e) {
            Serial.print(F("Humidity = "));
            Serial.print(data[5]);
            Serial.print(data[6]);
            humidity = (data[5] * 10) + data[6];
            Serial.println((" % "));
          }
          //==================================================================================
          basevar = Plugin_043_ProtocolCheckID(data[2]);

          event->Par1 = data[2];
          event->Par2 = basevar;
          event->SourceUnit    = 0;                     // Komt niet van een Nodo unit af, dus unit op nul zetten
          event->Port          = VALUE_SOURCE_RF;
          event->Type          = NODO_TYPE_PLUGIN_EVENT;
          event->Command       = 43; // Nummer van dit device

          if (basevar == 0) return true;
          //==================================================================================
          // set user variables
          if (data[2] == 0) {
            UserVar[basevar - 1] = (float)temperature / 10;
          }
          if (data[2] == 0x0e) {
            UserVar[basevar + 1 - 1] = (float)humidity;
          }

          RawSignal.Number = 0;
          success = true;
          break;
        }
      case PLUGIN_COMMAND:
        {
          if ((event->Par2 > 0) && (Plugin_043_ProtocolCheckID(event->Par1) == 0))
          {
            for (byte x = 0; x < 5; x++)
            {
              if (Plugin_043_ProtocolValidID[x] == 0)
              {
                Plugin_043_ProtocolValidID[x] = event->Par1;
                Plugin_043_ProtocolVar[x] = event->Par2;
                success = true;
                break;
              }
            }
          }
          break;
        }
#endif // PLUGIN_043_CORE

#if NODO_MEGA
      case PLUGIN_MMI_IN:
        {
          char *TempStr = (char*)malloc(INPUT_COMMAND_SIZE);

          if (GetArgv(string, TempStr, 1))
          {
            if (strcasecmp(TempStr, PLUGIN_NAME) == 0)
            {
              if (event->Par1 > 0 && event->Par1 < 255 && event->Par2 > 0 && event->Par2 <= USER_VARIABLES_MAX)
              {
                event->Type = NODO_TYPE_PLUGIN_COMMAND;
                event->Command = 43; // Plugin nummer
                success = true;
              }
            }
          }
          free(TempStr);
          break;
        }

      case PLUGIN_MMI_OUT:
        {
          strcpy(string, PLUGIN_NAME);           // Eerste argument=het commando deel
          strcat(string, " ");
          strcat(string, int2str(event->Par1));
          strcat(string, ",");
          strcat(string, int2str(event->Par2));
          break;
        }
#endif //NODO_MEGA
      }
      return success;
  }

  //#ifdef PLUGIN_043_CORE
  /*********************************************************************************************\
   * Check for valid sensor ID
   \*********************************************************************************************/
  byte Plugin_043_ProtocolCheckID(byte checkID)
  {
    for (byte x = 0; x < 5; x++) if (Plugin_043_ProtocolValidID[x] == checkID) return Plugin_043_ProtocolVar[x];
    return 0;
  }
  //#endif //CORE

Wenn du uns jetzt noch verrätst was dieser Sketch machen soll und welche Fehlermeldung du bekommst, können wir sicher auch drüberschauen.

Oh sorry Fehlermeldung ist

Arduino: 1.6.5 (Windows 8.1), Platine: "Arduino/Genuino Uno"

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\arduino\avr\cores\arduino -IC:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\arduino\avr\variants\standard C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\sketch_feb25c.cpp -o C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\sketch_feb25c.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-gcc -c -g -x assembler-with-cpp -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\arduino\avr\cores\arduino -IC:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\arduino\avr\variants\standard C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\arduino\avr\cores\arduino\wiring_pulse.S -o C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\wiring_pulse.S.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\wiring_pulse.S.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\hooks.c.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\WInterrupts.c.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\wiring.c.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\wiring_analog.c.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\wiring_digital.c.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\wiring_pulse.c.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\wiring_shift.c.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\abi.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\CDC.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\HardwareSerial.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\HardwareSerial0.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\HardwareSerial1.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\HardwareSerial2.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\HardwareSerial3.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\HID.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\IPAddress.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\main.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\new.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\Print.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\Stream.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\Tone.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\USBCore.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\WMath.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-ar rcs C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\WString.cpp.o

C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\tools\avr/bin/avr-gcc -w -Os -Wl,--gc-sections -mmcu=atmega328p -o C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/sketch_feb25c.cpp.elf C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp\sketch_feb25c.cpp.o C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a -LC:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp -lm

C:\Users\hbul65\AppData\Local\Temp\build5719548392865425129.tmp/core.a(main.cpp.o): In function main': C:\Users\hbul65\Downloads\arduino-1.6.5-r5-windows\arduino-1.6.5-r5\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference toloop' collect2.exe: error: ld returned 1 exit status Fehler beim Kompilieren.

und das ganze soll für einen Funksensor von Lacrosse sein.

Vielen Dank schon mal im vorraus

void loop() wird nicht gefunden. wenn du

void loop() {}

unten an den Sketch anhängst, kannst du ihn compilieren. Ob er dann das macht was er soll, ist aber eine ganz andere Frage.

ReneL: void loop() wird nicht gefunden. wenn du

void loop() {}

unten an den Sketch anhängst, kannst du ihn compilieren. Ob er dann das macht was er soll, ist aber eine ganz andere Frage.

Das wird nicht der Grund sein, die Loop ist vorhanden.

Was für ein Sensor ist das, poste mal einen Link.

du machst bei switch (function) {

ifdef PLUGIN_043_CORE

das #endif kommt aber erst in der Loop und die geschwungenen Klammern werden auch erst in der Loop geschlossen

Was mir noch aufgefallen ist, warum hast du in der Deklaration sämtliche Einträge auskommentiert? Ebenso im Setup.

Woher stammt dieser Sketch?

Da die strategischen #IFDEF eigentlich allen Kode ausblenden (auch den Versuch einer Deklaration von loop()), bleibt nachher nicht mehr viel über.

Und das enthält keine Definition von loop mehr.

uint8_t Plugin_043_ProtocolCRC( uint8_t *addr, uint8_t len);
byte Plugin_043_ProtocolCheckID(byte checkID);

byte Plugin_043_ProtocolValidID[5];
byte Plugin_043_ProtocolVar[5];

void setup() {}

boolean Plugin_043(byte function, struct NodoEventStruct *event, char *string)
{
  boolean success = false;
  switch (function)
  {
  }
  return success;
}

byte Plugin_043_ProtocolCheckID(byte checkID)
{
  for (byte x = 0; x < 5; x++) if (Plugin_043_ProtocolValidID[x] == checkID) return Plugin_043_ProtocolVar[x];
  return 0;
}

hi,

die loop ist, wenn die einrückungen stimmen, innerhalb eines case und das innerhalb eines ifdef. was soll das sein? eine "vielleicht-loop"?

gruß stefan

Sieht eher aus, wie ein fehlerhaftes "Copy and Paste".

Hallo den Link kann ich im Momment nicht finden das soll das Protokoll für einen Lacrosse Dx6 UH sein

hänge nochmal den original Script an.

plugin_043.zip (2.8 KB)

hbulf:
Hallo den Link kann ich im Momment nicht finden das soll das Protokoll für einen Lacrosse Dx6 UH sein

hänge nochmal den original Script an.

Und das möchtest du so auf dem Arduino laufen lassen?
Viel Erfolg.

P.S… wende dich an den Hersteller.

Ich bin da absolut am Anfang funktioniert das so nicht?

Was müsste verändert werden?

Der PLUGIN_043_CORE Teil wird so nie kompiliert, weil das nirgends definiert ist. Oben steht lediglich #define PLUGIN_ID 43. Das ist für die Funktion ganz am Ende.

Wenn du weißt was du tust lass die bedinge Kompilierung weg und schreibe rein was du wirklich brauchst

Ich habe da noch einen anderen Sketch der auch super funktioniert, alledrding bekomme ich da das Anzeigen der Luftfeuchte in dem dementsprechenden Anzeigefeld nicht hin.Kannst du mir da vielleicht weiter helfen?

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#include “DHT.h”

#define DHTPIN 2 // PIN # for DHT22 Temperature Sensor
#define TXPIN 10 // PIN # for 433Mhz Transmitter
#define LEDPIN 13 // PIN # for LED Indicator

#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor for normal 16mhz Arduino
DHT dht(DHTPIN, DHTTYPE);
// NOTE: For working with a faster chip, like an Arduino Due or Teensy, you
// might need to increase the threshold for cycle counts considered a 1 or 0.
// You can do this by passing a 3rd parameter for this threshold. It’s a bit
// of fiddling to find the right value, but in general the faster the CPU the
// higher the value. The default for a 16mhz AVR is a value of 6. For an
// Arduino Due that runs at 84mhz a value of 30 works.
// Example to initialize DHT sensor for Arduino Due:
//DHT dht(DHTPIN, DHTTYPE, 30);

unsigned long msg_timer = 60000; // Transmits a signal every 1 minute
unsigned long msg_gap = 32; //gap between packets

char buf[11]; //message to be built

void setup() {
Serial.begin(9600);
Serial.println(“Wireless Temp”);
pinMode(LEDPIN,OUTPUT);
pinMode(TXPIN, OUTPUT);
dht.begin();
}

// Changed int to float
// num is in Celsius. Ex) 26.30
// Brian May 24, 2015
void make_message(float num) {

// make up a TC6U message from the integer num (-500 to 499)

// parity table 0 1 2 3 4 5 6 7 8 9
char ptable={
0,1,1,2,1,2,2,3,1,2 }; //number of bits set
int p; //parity bit
char h,t,d; //hundreds,tens,digits

p=0; //clear parity

// preamble
buf[0] = 0;
buf[1] = 0xa; //message length and start bits
buf[2] = 0; //type = temperature
buf[3] = 0xf; //device ID
buf[4] = 0x0; //bottom bit is parity

// Adjusted digit mismatch in LA CROSSE WS-9016TWC
// Brian May 24, 2015
num = num * 10;

// encode the integer
num = num+500;
h = num/100;

buf[5] = h; //save hundreds
p += ptable; //update parity calculation
num = num - h100;
t = num/10;
buf[6] = t; //save tens
p += ptable[t]; //update parity
d = num - t
10;
buf[7] = d; //save digits
p += ptable[d];
buf[8] = h; //second copy of hundreds digit
buf[9] = t; //second copy of tens digit
//if value parity odd, set message parity bit
if ( (p&1) == 1) buf[4] |= 1;
//calculate and store checksum
buf[10] = (buf[1]+buf[3]+buf[4]+buf[5]+buf[6]+buf[7]+buf[8]+buf[9])&0x0F;
}
void send_one(char s) { //s=1 for short TXPIN off. 4th bit of quartet
digitalWrite(TXPIN,HIGH);
delayMicroseconds(588);
digitalWrite(TXPIN,LOW);
if (s) delayMicroseconds(1020);
else delayMicroseconds(1088);
}
void send_zero(char s) { //s=1 for short TX off, 4th bit of quartet
digitalWrite(TXPIN,HIGH);
delayMicroseconds(1400);
digitalWrite(TXPIN,LOW);
if (s) delayMicroseconds(1020);
else delayMicroseconds(1088);
}
void send_burst(char *msg) {
char i,c;
for(i=0; i<12; i++) {
c = *msg++; //values in lower 4 bits
//unroll inner loop, send a quartet
if(c&8) send_one(0);
else send_zero(0);
if(c&4) send_one(0);
else send_zero(0);
if(c&2) send_one(0);
else send_zero(0);
if(c&1) send_one(1); //“short tx off” (1020 us) for last bit
else send_zero(1);
}
}
// Changed int to float
// Brian May 24, 2015
void send_message(float num) {
digitalWrite(LEDPIN,HIGH);
make_message(num);
send_burst(buf);
delay(msg_gap);
send_burst(buf);
digitalWrite(LEDPIN,LOW);
}
void loop() {
// Wait a few seconds between measurements.
delay(2000);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)
float t = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(t)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}
Serial.print(t);
Serial.println(" *C\t");
send_message(t); // t is in Celisius. Ex) 26.30
delay(msg_timer);
}

Ich befürchte, dir fehlen erhebliche Grundlagen zur Programmierung des Arduinos.

Wo möchtest du denn die Luftfeuchte angezeigt bekommen, ich sehe hier kein Display.

Wo ist denn der Sketch her?

Ja da hast du sicher Recht und ich komme Schrit für Schritt weiter aber and iesem Punkt halt nicht.

Auf der Wetterstation sind zwei Anzeigen eine für die Temperatur die auch super funktioniert und daneben für die Luftfeuchte und bei diesem Feld wird halt nichts angezeigt.

Das Script ist von hier:https://github.com/briankimstudio/tx6u-arduino/blob/master/tx6u-arduino.ino

Ich kenne den Sensor DHT22 nicht, aber wie ich das sehe, musst du noch die Luftfeucht aus dem Sensor auslesen und diese anschließend senden.

Ja wenn ich die Werte für die Feuchte eintrage statt der Temperatur dann wird mir auch die Luftfeuchtigkeit angezeigt allerdings in dem Feld wo die Temperatur reingehört.

Danke schonmal im vorraus für die Hilfe

433Mhz TFA Sensor Werte senden…

hbulf:
Ja da hast du sicher Recht und ich komme Schrit für Schritt weiter aber and iesem Punkt halt nicht.

Auf der Wetterstation sind zwei Anzeigen eine für die Temperatur die auch super funktioniert und daneben für die Luftfeuchte und bei diesem Feld wird halt nichts angezeigt.

Das Script ist von hier:tx6u-arduino/tx6u-arduino.ino at master · briankimstudio/tx6u-arduino · GitHub

Da steht es doch:

  buf[2] = 0;    //type = temperature

Dein Code mit CODE Tags:

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#include "DHT.h"

#define DHTPIN  2     // PIN # for DHT22 Temperature Sensor
#define TXPIN   10    // PIN # for 433Mhz Transmitter
#define LEDPIN  13    // PIN # for LED Indicator

#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor for normal 16mhz Arduino
DHT dht(DHTPIN, DHTTYPE);
// NOTE: For working with a faster chip, like an Arduino Due or Teensy, you
// might need to increase the threshold for cycle counts considered a 1 or 0.
// You can do this by passing a 3rd parameter for this threshold.  It's a bit
// of fiddling to find the right value, but in general the faster the CPU the
// higher the value.  The default for a 16mhz AVR is a value of 6.  For an
// Arduino Due that runs at 84mhz a value of 30 works.
// Example to initialize DHT sensor for Arduino Due:
//DHT dht(DHTPIN, DHTTYPE, 30);

unsigned long msg_timer = 60000; // Transmits a signal every 1 minute
unsigned long msg_gap = 32; //gap between packets

char buf[11]; //message to be built

void setup() {
  Serial.begin(9600);
  Serial.println("Wireless Temp");
  pinMode(LEDPIN,OUTPUT);
  pinMode(TXPIN, OUTPUT);
  dht.begin();
}

// Changed int to float
// num is in Celsius. Ex) 26.30
// Brian May 24, 2015
void make_message(float num) {

  // make up a TC6U message from the integer num (-500 to 499)

  // parity table  0 1 2 3 4 5 6 7 8 9
  char   ptable[]={
    0,1,1,2,1,2,2,3,1,2  }; //number of bits set
  int p;  //parity bit
  char h,t,d;  //hundreds,tens,digits

  p=0; //clear parity

  // preamble
  buf[0] = 0;
  buf[1] = 0xa;  //message length and start bits
  buf[2] = 0;    //type = temperature
  buf[3] = 0xf;  //device ID
  buf[4] = 0x0;  //bottom bit is parity

  // Adjusted digit mismatch in LA CROSSE WS-9016TWC
  // Brian May 24, 2015
  num = num * 10;

  // encode the integer
  num = num+500;
  h = num/100;

  buf[5] = h;  //save hundreds
  p += ptable[h];  //update parity calculation
  num = num - h*100;
  t = num/10;
  buf[6] = t; //save tens
  p += ptable[t];  //update parity
  d = num - t*10;
  buf[7] = d; //save digits
  p += ptable[d];
  buf[8] = h; //second copy of hundreds digit
  buf[9] = t; //second copy of tens digit

  //if value parity odd, set message parity bit
  if ( (p&1) == 1) buf[4] |= 1;
  //calculate and store checksum
  buf[10] = (buf[1]+buf[3]+buf[4]+buf[5]+buf[6]+buf[7]+buf[8]+buf[9])&0x0F;
}

void send_one(char s) { //s=1 for short TXPIN off. 4th bit of quartet
  digitalWrite(TXPIN,HIGH);
  delayMicroseconds(588);
  digitalWrite(TXPIN,LOW);
  if (s) delayMicroseconds(1020);
  else delayMicroseconds(1088);
}

void send_zero(char s) { //s=1 for short TX off, 4th bit of quartet
  digitalWrite(TXPIN,HIGH);
  delayMicroseconds(1400);
  digitalWrite(TXPIN,LOW);
  if (s) delayMicroseconds(1020);
  else delayMicroseconds(1088);
}

void send_burst(char *msg) {
  char i,c;

  for(i=0; i<12; i++) {

    c = *msg++;  //values in lower 4 bits

    //unroll inner loop, send a quartet

    if(c&8) send_one(0);
    else send_zero(0);
    if(c&4) send_one(0);
    else send_zero(0);
    if(c&2) send_one(0);
    else send_zero(0);
    if(c&1) send_one(1); //"short tx off" (1020 us) for last bit
    else send_zero(1);
  }
}

// Changed int to float
// Brian May 24, 2015
void send_message(float num) {
  digitalWrite(LEDPIN,HIGH);
  make_message(num);
  send_burst(buf);
  delay(msg_gap);
  send_burst(buf);
  digitalWrite(LEDPIN,LOW);
}

void loop() {
  // Wait a few seconds between measurements.
  delay(2000);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float t = dht.readTemperature();

  // Check if any reads failed and exit early (to try again).
  if (isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Serial.print(t);
  Serial.println(" *C\t");

  send_message(t); // t is in Celisius. Ex) 26.30
  delay(msg_timer);
}