rc-switch icon indicating copy to clipboard operation
rc-switch copied to clipboard

Receive and ATiny85

Open danjohn opened this issue 7 years ago • 21 comments

The implementation disables receive features on ATtiny's due to "missing libm depencies (udivmodhi4)".

I don't know, maybe that requirement has changed in the last few months (new libs? adapted code?), but I can definitely compile and (obviousely successful) run that receive code on a DigiSpark-like target.

Hopefully this could be verified by a more experienced user!? (Also, I can't see where "divmod" would be used in the sources (pls give a noob a hint!:))

All I did for testing, was to comment out "#define RCSwitchDisableReceiving" in RCSwitch.h (line 56). Sketch:

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
const int LED = 1;

void setup() {                
  mySwitch.enableReceive(0);  // Receiver on interrupt 0 => that is pin #2
  pinMode(LED,OUTPUT);
}

void loop() {
   if (mySwitch.available()) {
      digitalWrite(LED,HIGH);
      mySwitch.resetAvailable();
      delay(10);
   } else {
      digitalWrite(LED,LOW);
   }
}

Blinks when I press a button on my RC key.

IDE: arduino-1.8.2-linux32 RC-switch: version of Feb 27, 2017 Target: http://www.electrodragon.com/product/attiny85-usb-mini-dev-board-digispark-compatible/

danjohn avatar May 10 '17 07:05 danjohn