Author Topic: Library incompatibility?  (Read 3592 times)

probono

  • Newbie
  • *
  • Posts: 17
Library incompatibility?
« on: January 05, 2013, 05:03:00 pm »
I'm trying to get rc-switch to run. The sketch below "should" receive commands from a 433 MHz remote control. Unfortunately, it looks like the two includes don't like each other, because when I upload the sketch and replug it, I get lots of USB errors... I suspect that both includes use timers and/or interrupts. If that's true: Is there a generic way to resolve conflicts like this?


/*
  Modified http://code.google.com/p/rc-switch/ example for receiving - NOT WORKING
*/

#include
#include

RCSwitch mySwitch = RCSwitch();

void setup() {
  DigiUSB.begin();
  mySwitch.enableReceive(0);
}

void loop() {
  if (mySwitch.available()) {
    DigiUSB.println(mySwitch.getReceivedValue());
    DigiUSB.println(mySwitch.getReceivedBitlength());
    DigiUSB.println(mySwitch.getReceivedDelay());
    DigiUSB.println(mySwitch.getReceivedProtocol());
    mySwitch.resetAvailable();
  }
}
« Last Edit: January 05, 2013, 05:03:00 pm by probono »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Library incompatibility?
« Reply #1 on: January 06, 2013, 11:49:17 pm »
DigiUSB turns the timer interrupt off, it also messes with interrupts on each send and receive - in addition the rc-switch probably makes extensive use of timer which may be on different ports with the Digispark - but if it compiles maybe not... so then it is just a timer issue - no generic way to resolve it, eventually I\'d like to evolve the DigiUSB library to allow you to use other timer dependent things with it, but that might be few weeks yet if someone else doesn\'t do it first.

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Library incompatibility?
« Reply #2 on: January 07, 2013, 04:51:22 pm »
Ah this answers my trouble @digistump. I\'m also stalling on a project because millis wasn\'t working with digiusb. I think I\'ve come up with a timer-free solution to my problem now, but I do hope millis starts working again in a future version. :)