Is it possible to assign PINs to anoter PCINT vector for robot programming ?

Hallo,

I am quiet a newbie. I am wondering, if someone could help me with this? I have a project from university to program a robot based on a Leonardo board.

Except the ICSP PINs, all other PINs are occupied by sensors, motors, ect. I have to communicate over these PINs via SoftwareSerial library, using PIN 16 and 14 for this.

Furthermore, I have to do Obstacle detetection with two IR Receiver, which is on PIN 17. For this I am using a ISR routine.

Apperantly both the PINs for SoftwareSerial communication and the PIN for the IR receiver are in the same PCINT0_vect vector, which is triggered in case of a change on these PINs. This is the reason, ehy I can't compile the code.

Is there a way I can use both anyway? Can I assigne PINs to another vector?

Thank you for a fast answer.

No, the pins are inextricably linked to the one interrupt vector. The best you could do is change which pins you are using.

It's not possible, because all the PINs are in use already and the other hardware like engines or sensors are glued to the board, no possibility to get other free Pins. The robot is just borrowed from university, so I shouldnt destroy it.

SoftwareSerial needs pin change interrupts because high bit rates need the speed.

benzer wrote (in part):

Furthermore, I have to do Obstacle detetection with two IR Receiver, which is on PIN 17. For this I am using a ISR routine.

Do your IR receivers really need this speed for obstacle detection? Can you just poll the IR receivers in the loop() function (instead of using an ISR) to determine whether or not there is an obstacle?

How do two IR receivers both use pin 17?

benzer: I have to communicate over these PINs via SoftwareSerial library, using PIN 16 and 14 for this.

Are you writing to SoftwareSerial only? Or reading as well?

Sorry, there is only one receiver at PIN 17 and two transmitter, I mixed it up.

Yes I have to receive and send: Receive the command and send if it was executed or an obstacle discovered.

Mght this idea work: While I am communicating, I attach the Interrupt to the SoftwareSerial and unattach it afterwards. While I am driving and detecting obstacle, I attach it to the Receiver?

I will try to find a way to just pull the signal, but to use interrupt would be more suitable for my usecase, i think.

Thank you for your answers already.