I'm trying to add SPI communication to an existing library, rather than using the parallel ports.
I've included the following inside the CPP file:
#include <SPI.h>
Then inside the init function, where the ports were defines as inputs/outputs
SPI.begin();
PinMode (4, OUTPUT)
SPI.setBitOrder(MSBFIRST);
SPI.setClockDivider(SPI_CLOCK_DIV64);
and finally where the data was written I replaced with
PORTD &= ~_BV(4); // Turn SS LOW);
SPI.transfer ((byte)data); // send out 8 bits
PORTD |= _BV(4); // Turn SS high - data output changes on this rising edge
Nothing ever comes out from the SPI port. What am I missing?
PS: Empty space on the code = forum bug?