Nrf pins declare in code

hello everyone, i was able to use my nrf modules with arduino uno icsp pins as miso, mosi and sck instead of the digital ones 9,10.. i know that ce and csn are declared in the code but how about the rest of the as i mentioned ? if they uses digital pins 9, 10, 11 without me having to declare them, when i use icsp pins i would be able to use those digital pins instead for other jobs as i declare them in the code to so other thing, buttons, or they are already taken by nrf library ?

I am not clear what you are asking but be aware that the MOSI, MISO and SCK pins on the ICSP header are pins 11, 12 and 13 on the Uno so you cannot use them for other purposes if you are using them for the SPI interface

See here to see how to set up soft SPI.

However, SPI is a bus so multiple devices can use the same pins for SCK, MOSI and MISO. Each device has its own chip select pin. See SPI bus.

why to be aware of icsp ? i was asking that if i use icsp pins miso, mosi and sck for the nrf instead of the digital ones usualy used, can i use the digital instead for something else or they are declared somewhere that they are being used by the nrf ?

Sorry, I misunderstood.


The SCK, MOSI and MISO pins on the ICSP connector are physically the same as the SPI pins on the digital header. They are connected on the PC board.

ok, and they are built in to be used for that purpose or they can be changed in the software ?

If you are not using the SCK, MOSI and MISO pins then you can, of course, use them for other purposes as normal digital pins 13, 11, and 12

What you cannot do with a Uno is to define some other pins as SCK, MOSI and MISO and use the normal SPI functions

Question is ambiguous. What is "they"?

You can change the pins that the rf24 module uses for SCK, MOSI and MISO using the soft SPI that I linked and then use the hardware SPI pins for something else. You cannot change the pins that are used for hardware SPI or the pins that connect to the ICSP header.

also i i want to control the base of a transistor that commands a relay with a digital pins from arduino, when the board first powers up what state the pins are ? if should be off until i give the command to turn on and activate the relay. if i do digital write low then pinMode output for every pin the relay are on to, would that be enought to not trigger it for some milliseconds or less ?

digitalWrite(relayD; LOW);
  pinMode(relayD; OUTPUT); 

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