Author Topic: rfreceiver.h library problem  (Read 655 times)

ahmadasadi

  • Newbie
  • *
  • Posts: 1
rfreceiver.h library problem
« on: October 01, 2018, 04:02:37 am »
hi  everybody
i want to use rfreceiver.h library in digispark.
i used rftransmitter.h with digiaprk and it works well but
rfreceiver.h doesn't work.
my code is :
#include <PinChangeInterruptHandler.h>
#include <RFReceiver.h>

// Listen on digital pin 2
RFReceiver receiver(2);

void setup() {
 
  pinMode(0,OUTPUT);
  receiver.begin();
}

void loop() {
  char msg[MAX_PACKAGE_SIZE];
  byte senderId = 0;
  byte packageId = 0;
  String str="Hello World!";
  byte len = receiver.recvPackage((byte *)msg, &senderId, &packageId);
  if((String)msg == str)
  {
    digitalWrite(0,HIGH);
    delay(500);
    digitalWrite(0,LOW);
    delay(500);
  }

}

and transmitter code is :
#include <RFTransmitter.h>

#define NODE_ID          1
#define OUTPUT_PIN       1

// Send on digital pin 11 and identify as node 1
RFTransmitter transmitter(OUTPUT_PIN, NODE_ID);

void setup() {}

void loop() {
  char *msg = "Hello World!";
  transmitter.send((byte *)msg, strlen(msg) + 1);

  delay(5000);
 
  transmitter.resend((byte *)msg, strlen(msg) + 1);
}

anybody pls help me
thanks a lot