change pin 12 assignment



  • hello,
    i use a pro mini and the nrf24+.
    my pin12 is broken, so i want to set it to pin5, but i can´t find the pin assignment for this.
    i found in nrf24_con.h:
    const uint8_t SOFT_SPI_MISO_PIN = 16;
    but initial it should be 12, so i´m confused.

    can anybody help me please?



  • Pin 16 is analog pin 2. Analog pins can also be used as digital pins.
    A0 = 14
    A1 = 15
    A2 = 16
    A3 = 17
    A4 = 18
    A5 = 19

    And btw, are you asking this for a gateway device or a sensor device?



  • thank you verry much,
    i´m asking for a sensordevice.

    im already using other sensor devices with pin12 (default-sketches).
    now i was searching for a code where is pin 12 assigned, but i couldn´t find it.

    do you know where pin 12 is assigned?


  • Hero Member

    By default SOFTSPI is disabled. Edit your MyConfig.h file to enable SOFTSPI and the pin assignments: https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MyConfig.h#L123

    Cheers
    Al



  • thank you, but where is the original pin 12 assignment ?
    i don´t want to use softspi, just change the default pin12 to pin 5


  • Hero Member

    @s3bb0 Pin 12 is the MISO pin which from what I understand, hard-coded in the inner workings of the Atmel chip and Arduino libraries, not the MySensors libraries, so you may have to use SOFTSPI to get this working. @hek, can you confirm?

    Thanks
    Al



  • in pins_arduino.h i found the pin 12 but changeing it brings no result.

    thanks @Sparkman ok but if i try this to comment that part in, i get a error on compiling:

    Arduino: 1.6.4 (Mac OS X), Platine: "Arduino Pro or Pro Mini, ATmega328 (3.3V, 8 MHz)"

    Verwende die Bibliothek SPI im Ordner: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SPI
    Verwende die Bibliothek MySensors im Ordner: /Users/..../Documents/Arduino/libraries/MySensors (legacy)

    /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=8000000L -DARDUINO=10604 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/eightanaloginputs -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SPI -I/Users//Documents/Arduino/libraries/MySensors /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build3964050026628109026.tmp/final_AnalogSoilMoistSensor.cpp -o /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build3964050026628109026.tmp/final_AnalogSoilMoistSensor.cpp.o
    In file included from /Users/
    /Documents/Arduino/libraries/MySensors/MyTransportNRF24.h:26:0,
    from /Users//Documents/Arduino/libraries/MySensors/MySensor.h:28,
    from final_AnalogSoilMoistSensor.ino:2:
    /Users/
    /Documents/Arduino/libraries/MySensors/utility/RF24.h:20:23: fatal error: DigitalIO.h: No such file or directory
    #include <DigitalIO.h>
    ^
    compilation terminated.
    Fehler beim Kompilieren.


  • Hero Member

    @s3bb0 Are you using the 1.5 libraries or 1.4?



  • first 1.4 but now i tried 1.5.


  • Contest Winner

    SOFTSPI is a software implementation of the SPI protocol which permits the use of any digital IO for use in the SPI bus.
    If you are not using SOFTSPI, you use HW accelerated SPI, and that means you are bound to the specific pins on the MCU that has this capability. You cannot choose which pin to use in this case.



  • ah ok, now i understand this 🙂

    ok, how can i use softspi and deaktivate the HWSPI ?

    as a said , commenting in the line for softspi results in an error



  • in RF24_config.h change

      //#define SOFTSPI   // Requires library from https://github.com/greiman/DigitalIO
    

    to

      #define SOFTSPI   // Requires library from https://github.com/greiman/DigitalIO
    

    And put DgitalIO into Documents/Arduino (download from the link provided)


  • Hero Member

    DigitialIO is included with the MySensors libraries and should not need to be downloaded separately. @hek and @Anticimex, it looks like there are two places to uncomment the #define SOFTSPI line: RF24_config.h and MyConfig.h. Can you confirm where this should be done or does it not matter? @s3bb0 did you delete all of the 1.4 files before copying in the 1.5 ones and then restart the IDE?

    Cheers
    Al


  • Contest Winner

    @Sparkman sorry, I have only used hw SPI. So I am not very familiar with the settings for soft SPI.


  • Admin

    You should only need to uncomment it in MyConfig.h



  • i tried to change it in MyConfig.h and installed 1.5 and even 1.4 again but still errors....

    var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/PinIO.cpp.o: In function PinIO::begin(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/PinIO.cpp:43: multiple definition of PinIO::begin(unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/PinIO.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/PinIO.cpp:43: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/PinIO.cpp.o: In function PinIO::begin(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/PinIO.cpp:43: multiple definition of PinIO::PinIO(unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/PinIO.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/PinIO.cpp:43: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/PinIO.cpp.o: In function PinIO::begin(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/PinIO.cpp:43: multiple definition of PinIO::PinIO(unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/PinIO.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/PinIO.cpp:43: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/PinIO.cpp.o: In function PinIO::begin(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/PinIO.cpp:43: multiple definition of PinIO::config(bool, bool)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/PinIO.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/PinIO.cpp:43: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/SoftI2cMaster.cpp.o: In function SoftI2cMaster::read(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/SoftI2cMaster.cpp:160: multiple definition of SoftI2cMaster::read(unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/SoftI2cMaster.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/SoftI2cMaster.cpp:160: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/SoftI2cMaster.cpp.o: In function SoftI2cMaster::read(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/SoftI2cMaster.cpp:160: multiple definition of SoftI2cMaster::start()'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/SoftI2cMaster.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/SoftI2cMaster.h:136: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/SoftI2cMaster.cpp.o: In function SoftI2cMaster::read(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/SoftI2cMaster.cpp:160: multiple definition of SoftI2cMaster::stop()'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/SoftI2cMaster.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/SoftI2cMaster.h:136: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/SoftI2cMaster.cpp.o: In function SoftI2cMaster::read(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/SoftI2cMaster.cpp:160: multiple definition of SoftI2cMaster::write(unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/SoftI2cMaster.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/SoftI2cMaster.h:136: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/SoftI2cMaster.cpp.o: In function SoftI2cMaster::read(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/SoftI2cMaster.cpp:160: multiple definition of I2cMasterBase::transferContinue(void*, unsigned int, unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/SoftI2cMaster.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/SoftI2cMaster.h:136: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/SoftI2cMaster.cpp.o: In function SoftI2cMaster::read(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/SoftI2cMaster.cpp:160: multiple definition of I2cMasterBase::transfer(unsigned char, void*, unsigned int, unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/SoftI2cMaster.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/SoftI2cMaster.h:136: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/SoftI2cMaster.cpp.o: In function SoftI2cMaster::read(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/SoftI2cMaster.cpp:160: multiple definition of SoftI2cMaster::begin(unsigned char, unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/SoftI2cMaster.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/SoftI2cMaster.h:136: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/SoftI2cMaster.cpp.o: In function SoftI2cMaster::read(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/SoftI2cMaster.cpp:160: multiple definition of SoftI2cMaster::SoftI2cMaster(unsigned char, unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/SoftI2cMaster.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/SoftI2cMaster.h:136: first defined here
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/utility/SoftI2cMaster.cpp.o: In function SoftI2cMaster::read(unsigned char)': /Users/..../Documents/Arduino/libraries/MySensors/utility/SoftI2cMaster.cpp:160: multiple definition of SoftI2cMaster::SoftI2cMaster(unsigned char, unsigned char)'
    /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp/MySensors/SoftI2cMaster.cpp.o:/Users/..../Documents/Arduino/libraries/MySensors/SoftI2cMaster.h:136: first defined here
    collect2: error: ld returned 1 exit status
    Fehler beim Kompilieren.


  • Hero Member

    @s3bb0 Looks like you may have multiple copies of the libraries or both 1.4 an 1.5 installed at the same time. Make sure you delete all the libraries before installing the new ones.

    Cheers
    Al



  • This post is deleted!

  • Contest Winner

    You probably need to purge your temp folder as well. The Arduino IDE is stupid and might believe it can re-use old build artifacts. (/var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build4313290786347724905.tmp)



  • thank you all, but its still the problem.

    i deleted everything, even the temporary files.
    i installed everything (arduinoIDE + mysensors 1.5). everythin works until i comment the softSPI in.
    then it reports: the DigitalIO.h error-.
    Arduino: 1.6.5 (Mac OS X), Platine: "Arduino Pro or Pro Mini, ATmega328 (3.3V, 8 MHz)"

    Verwende die Bibliothek SPI im Ordner: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SPI
    Verwende die Bibliothek MySensors im Ordner: /Users/-------/ArduinoNEW/libraries/MySensors (legacy)

    /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=8000000L -DARDUINO=10605 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/eightanaloginputs -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SPI -I/Users/----/ArduinoNEW/libraries/MySensors /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build8452403048590699508.tmp/LightSensor.cpp -o /var/folders/ts/_xf3xpf1769419gyjrkmv7yc0000gn/T/build8452403048590699508.tmp/LightSensor.cpp.o
    In file included from /Users/-----/ArduinoNEW/libraries/MySensors/MyTransportNRF24.h:26:0,
    from /Users/----/ArduinoNEW/libraries/MySensors/MySensor.h:28,
    from LightSensor.ino:30:
    /Users/----/ArduinoNEW/libraries/MySensors/utility/RF24.h:20:23: fatal error: DigitalIO.h: No such file or directory
    #include <DigitalIO.h>
    ^
    compilation terminated.
    Fehler beim Kompilieren.

    then i checked /Users/----/ArduinoNEW/libraries/ AND
    /Users/----/ArduinoNEW/libraries/DigitalIO/
    for the DigitalIO.h ==> IN BOTH EXISTS DigitalIO.h because i copied it for testing.

    that is so strange ... 😞


  • Admin

    Did you include DigitaiIO in your sketch as well?
    This is required in the Arduino-world in order having the linker to pick it up.


Log in to reply
 

Suggested Topics

  • 1
  • 3
  • 2
  • 2
  • 1
  • 5

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts