How to reset all setup in the midst of sketch

Hi there, I have been asking this question for few times..sry for that as my problem is still unsolved...
I am using both LMIC and Radio Head RF95 library in one sketch.. but there is conflict of pin assigned in these two libraries.. so I am wondering if there is any way to reset the pin setup after done using one of the library? so that I can reassign the pin for another library..
I am planning to use RF95 and should be followed by LMIC libraries..

Maybe this is not needed. I have never used these modules. If I understand correctly, they both use the SPI interface. But from that

you can change SS pin.
'The SS (slave select) connection is a bit more flexible. On the SPI slave side (the transceiver), this must be connect to the pin (typically) labeled NSS. On the SPI master (Arduino) side, this pin can connect to any I/O pin. Most Arduinos also have a pin labeled "SS", but this is only relevant when the Arduino works as an SPI slave, which is not the case here. Whatever pin you pick, you need to tell the library what pin you used through the pin mapping (see below).'
Thus, both modules will use the same pins for SPI but different SS pin. Just saying.

Check out this thread


???As I mentioned in the post, the problem is still unsolved. In fact I managed to connect LG-01N to TTN solely..

SS pin? The conflict pins include reset pin and those..which is the only one in the board...

What? The libraries use the reset pin? That is very unusual.

But it seems you have elsewhere been advised that in order to do what you want, you will have to modify one or the other library.

That sounds like fun.

On the other hand, Arduino boards are cheep inexpensive, you could just use two and invent or exploit an existing board-to-board communication link to coordinate the activities required.

That sounds like fun.

So, as usual, it all comes down to what kind of fun you want to have.



Ya, I know, but it has to be the intermediate board in order to communicate with board that has different frequency operating.

Here is the conflict pins:

// Pin mapping
const lmic_pinmap lmic_pins = {
    .nss = 10,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 9,
    .dio = {2, 6, 7},    //LMIC libraries
#define RFM95_CS 10
#define RFM95_RST 7
#define RFM95_INT 2   //radiohead libraries

and the frequency set are different too

OK, you are making no sense whatsoever.

Why can’t you use two Arduino boards to accomplish this role of intermediation, since you don’t seem to have the skill or desire to make one board work?


it is the requirement for my project..

Thanks for reminding me, but thats the reason why I am asking for guide here

Update: It might not because of reset pin probs, but still, I think I have to reset all setup in order to make the board work in different frequency after running through another..

so my current prob is , How do I reset all setup after done running through one of the frequncey and to be continued in another one?

Post both setup functions here. Explain what pins are i conflict, good we have established that the reset pin is not one of them.

There is no requirement that pin modes be set, once and forever, in the setup(). You can change them any time.

Libraries may make pin mode settings when you initialise them or create objects they use.

This will be harder to change, and is why it is suggested that you may have to modify the libraries.

Or at least learn about their internal operations to safely and confidently work behind the scenes to keep them happy whilst not using one or the other.

Any devices connected to the Arduino must also be happy with, or at least survive, what to them may seem arbitrary and capricious changes of pin modes or the signals that may appear on them

As Marco said to Polo, good luck with that.

Whose requirement is that you only use one program? I thought you had a real problem to solve, your mind should be open to all solutions, no matter how offensive they may seem.


This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.