-
-
Notifications
You must be signed in to change notification settings - Fork 213
Closed
Description
I've used an Arduino Nano with SPI.h to make a SPI Slave. Now I have the Nano 33 BLE and want to use the same code, but there are Errors when I build the file. Does anyone have an idea what's the issue?
The Code:
#include <SPI.h>
volatile byte c;
volatile byte command = 0;
void setup (void)
{
// have to send on master in, *slave out*
pinMode(MISO, OUTPUT);
pinMode(MOSI, INPUT);
// turn on SPI in slave mode
SPCR |= _BV(SPE);
// turn on interrupts
SPI.attachInterrupt();
Serial.begin(115200);
} // end of setup
// SPI interrupt routine
ISR (SPI_STC_vect)
{
c = SPDR;
Serial.println(SPDR);
//SPDR = 8;
} // end of interrupt service routine (ISR) SPI_STC_vect
void loop (void)
{
if (digitalRead (SS) == HIGH)
command = 0;
} // end of loop
The Error:
src\main.cpp: In function 'void setup()':
src\main.cpp:15:3: error: 'SPCR' was not declared in this scope
SPCR |= _BV(SPE);
^~~~
src\main.cpp:15:3: note: suggested alternative: 'SPI'
SPCR |= _BV(SPE);
^~~~
SPI
src\main.cpp:15:15: error: 'SPE' was not declared in this scope
SPCR |= _BV(SPE);
^~~
src\main.cpp:15:15: note: suggested alternative: 'SPI'
SPCR |= _BV(SPE);
^~~
SPI
src\main.cpp:15:11: error: '_BV' was not declared in this scope
SPCR |= _BV(SPE);
^~~
src\main.cpp: At global scope:
src\main.cpp:24:5: error: expected constructor, destructor, or type conversion before '(' token
ISR (SPI_STC_vect)
^
*** [.pio\build\nano33ble\src\main.cpp.o] Error 1
Metadata
Metadata
Assignees
Labels
No labels