Arduino and Picaxe Interfacing

Hi Folks. I am in the process of moving some of my projects from PicAxe to Arduino. There are a couple of low level project that basically don;t need the power of an Arduino (plus I already have the picAxes’s for them)

Now - one of the tricks re inter PicAxe communication is to set an interrupt on a pin and when this pin is raised HIGH - jump to a routine that reads serial from the same pin.

The sending picAxe raises the pin HIGH, waits 20ms and then sends the serial.

Can this be done easily with an Arduino re using the same pin as digital, interrupt, and serial (of course not all at the same time - code will change the pin’s function as required)

Many thanks

You can attach interrupt handlers to most pins. When the interrupt handler is triggered, you could set a flag that is checked on the next pass through loop. If the flag is set, you could create an instance of NewSoftSerial that uses that in as the RX pin, to read serial data.

But, the question is why. NewSoftSerial has an available() method, and a receive buffer. The pin is basically dedicated to serial I/O. You can see whether there is serial data to read by using the NewSoftSerial::available() function. No interrupt handler is needed.

Hi PaulS Many thanks for replying. Actually it will be the Arduino calling the PicAXE so all I need to do is set a Arduino pin high and then send serial on it.

It would be great to then swap function and read serial on it so I can get a reply from the PicAxe.


PIN5 connected to PicAxe

PIN5 High ' trigger interrupt Wait 20ms ' Picaxe to settle and wait to recieve Send PIN5, "A1" ' Give me battery Voltage Wait 5ms ' Picaxe to get data and send Recv PIN5, Battv ' Get Battrty Voltage Display Battv

As I mentioned this is my first trial of Arduino and I really like the flexibility of the language

Take Care Dave