Closed wilhelmzeuschner closed 6 years ago
The Slave Select pin is not declared as an output and thus no digitalWrite()-operations work properly.
void setup() {
pinMode(SS, OUTPUT); //Default is pin 5, can be changed
...
}
SS not declared as output (you can see some crosstalk from the SPI communication but no real activity on that pin):
SS declared as output:
Created a pull-request: #8
Excellent stuff, thanks! Do you think SS should be declared as an output for nano as well?
I'll let you close this when you deem all the issues are worked out. Cheers
At first, when I figured out the solution for the ESP32 if left out #ifdef ESP32 ...
Later when I recompiled the code for an Arduino Nano it did not work.
My guess is that the different platforms handle the SPI-interfacing differently.
I'll close this issue now, since this compatibility issue has been resolved. I thank you too for your great work!
Maybe you could improve the design of the example sketch a little bit:
#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
#define CC1101Interrupt 4 // Pin 19
#define CC1101_GDO0 19
#elif defined(__MK64FX512__)
// Teensy 3.5
#define CC1101Interrupt 9 // Pin 9
#define CC1101_GDO0 9
#else
#define CC1101Interrupt 0 // Pin 2
#define CC1101_GDO0 2
#endif
CC1101_GDO0
is also defined in cc1101.h but the definition gets overridden by the example.
Also you could add #ifdef ESP32 ...
(and point out that many different pins can be used '*') to the example, depending on you want to handle things.
'*' It's best to choose a pin >= 34, since those are only input.
I'd love to use this library with an ESP32 board but it does not work. I have used the SPI pins:
Unfortunately this doesn't work properly:
I get this same result when I use an Arduino Nano (with unmodified library) and simply "unplug" the module. Communication between two Nanos works fine.
The ESP32 handles interrupts a bit differently compared to an Arduino Nano, I think that I have adopted my code accordingly. ESP32_CC1101.zip