Re: Octolively with external sensors; communicate via ISP, or other pins?

Home Evil Mad Scientist Forums Microcontrollers Octolively with external sensors; communicate via ISP, or other pins? Re: Octolively with external sensors; communicate via ISP, or other pins?

#21494
emsfly
Participant

Most excellent!    Is there a list of commands/example of using the SPI to talk say, from an Arduino?

I see that the lovely USBtinyISP kit is needed to reprogram the Octolively, if needed.   Time to procure one posthaste.

Is the source code just what is at github?  This does seem to have the current functionality, but don’t see how SPI commands would be interpreted (unless I’m missing something completely here).

https://github.com/oskay/Octolively/blob/master/firmware/octolively.c

I do see that pins PB5, PB6, and PB7 are ‘free’, in that once new code is downloaded, they could be used.   If we were to reprogram the Octolively, perhaps those could be used as I/O pins.   I see this lovely bit (no pun intended) here in the code, which is hooked up to Pin B5, so a similar piece of code could be used for inputs using PB6 and PB7:

int readButton() {
  return (! bit_is_set(PINB, PINB5));
}

I also see:

int receive_from(uint8_t dir)

which apparently handles inputs PB1 through 4, but they are used for between board communication.   Haven’t *quite* figured out how to configure an output, though.   I think I need to look at the code at this point for that, it seems that might be the ticket:

DDRB  = ComOutputMask; // All B Inputs except for pin PB0, our output.
PORTB = ComOutputMask | ComInputMask; // Pull-ups on input lines, output line high to start.