Created
May 6, 2017 12:28
-
-
Save TheCrazyT/9dc3e6dd31230b493ccf9b2e39fb5215 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
void setup() { | |
Serial.begin(115200); | |
Serial.println("Test1"); | |
pinMode(MISO, OUTPUT); | |
pinMode(SS, INPUT); | |
pinMode(SCK, INPUT); | |
pinMode(MOSI, INPUT); | |
SPCR |= _BV(SPE); | |
SPCR &= ~_BV(MSTR); | |
SPI.attachInterrupt(); | |
} | |
// SPI interrupt routine | |
ISR (SPI_STC_vect) | |
{ | |
Serial.println((char)SPDR); | |
//SPI.transfer('X'); //Enabling this line produces problems | |
} // end of interrupt routine SPI_STC_vect | |
void loop() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
void setup() { | |
Serial.begin(115200); | |
while (!Serial) { | |
; // wait for serial port to connect. Needed for native USB port only | |
} | |
Serial.println("Test2"); | |
SPI.begin(); | |
//SPI.attachInterrupt(); //Enabling this line produces problems | |
} | |
// SPI interrupt routine | |
ISR (SPI_STC_vect) | |
{ | |
Serial.println((char)SPDR); | |
} | |
void loop() { | |
SPI.transfer('A'); | |
delay(1000); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment