尝试在arduino uno wifi上使用rgb矩阵时“未声明SPCR”

问题描述

我尝试了一些示例程序来使arduino uno wifi上的rgb矩阵正常工作。我觉得自己是个白痴,我无法弄清这一点,而且我用谷歌搜索无济于事。错误代码如下。问题在于rgbmatrix库引用的是未定义的var。我是否缺少需要导入的另一个库?我对arduino完全陌生,但是我已经使用netduino和粒子光子fwiw进行了开发。

感谢您的帮助。我正在尝试为我的男孩建造一个带有炫酷显示效果的火箭书架,但是如果我不能超过这个目标,它将失去很多炫酷效果:)。

/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp: In member function 'void cRGBMatrix::begin(int)':
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:5: error: 'SPCR' was not declared in this scope
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,Master Mode,divide clock by 16    //SPI Bus setup
     ^~~~
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:5: note: suggested alternative: 'SCL'
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,divide clock by 16    //SPI Bus setup
     ^~~~
     SCL
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:16: error: 'SPE' was not declared in this scope
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,divide clock by 16    //SPI Bus setup
                ^~~
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:16: note: suggested alternative: 'PE'
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,divide clock by 16    //SPI Bus setup
                ^~~
                PE
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:25: error: 'MSTR' was not declared in this scope
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,divide clock by 16    //SPI Bus setup
                         ^~~~
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:25: note: suggested alternative: 'PSTR'
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,divide clock by 16    //SPI Bus setup
                         ^~~~
                         PSTR
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:35: error: 'SPR1' was not declared in this scope
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,divide clock by 16    //SPI Bus setup
                                   ^~~~
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:35: note: suggested alternative: 'SPI0'
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,divide clock by 16    //SPI Bus setup
                                   ^~~~
                                   SPI0
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:45: error: 'SPR0' was not declared in this scope
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,divide clock by 16    //SPI Bus setup
                                             ^~~~
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:48:45: note: suggested alternative: 'SPI0'
     SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Enable SPI HW,divide clock by 16    //SPI Bus setup
                                             ^~~~
                                             SPI0
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp: In member function 'char cRGBMatrix::spiTransfer(char)':
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:78:5: error: 'SPDR' was not declared in this scope
     SPDR = value;                    // Start the transmission
     ^~~~
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:78:5: note: suggested alternative: 'SDA'
     SPDR = value;                    // Start the transmission
     ^~~~
     SDA
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:79:14: error: 'SPSR' was not declared in this scope
     while (!(SPSR & (1<<SPIF)))     // Wait for the end of the transmission
              ^~~~
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:79:14: note: suggested alternative: 'SS'
     while (!(SPSR & (1<<SPIF)))     // Wait for the end of the transmission
              ^~~~
              SS
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:79:25: error: 'SPIF' was not declared in this scope
     while (!(SPSR & (1<<SPIF)))     // Wait for the end of the transmission
                         ^~~~
/Users/johnwest/Documents/Arduino/libraries/RGBMatrix/RGBMatrix.cpp:79:25: note: suggested alternative: 'SPI0'
     while (!(SPSR & (1<<SPIF)))     // Wait for the end of the transmission
                         ^~~~
                         SPI0
exit status 1
Error compiling for board Arduino Uno WiFi Rev2.

                ^~~
#include <SPI.h>

#include <RGB.h>
#include <RGBMatrix.h>

void setup() {
  // put your setup code here,to run once:

}

void loop() {
  // put your main code here,to run repeatedly:

}

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)