Digistump Forums
The Digispark => Digispark (Original) Support => Topic started by: probono 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();
}
}
-
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.
-
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. :)