我的arduino程序中有一个列表形式的正弦波查找表。我用计算器来生成它。我用python 2 shell确认了列表的长度,
>>>a=[all the variables separated by commas]
>>>len(a)
131300是作为'a'中的值的数量返回的值。那么为什么当我运行这段代码时:
#include <Wire.h>//Include the Wire library to talk I2C
//This is the I2C Address of the MCP4725, by default (A0 pulled to GND).
#define MCP4725_ADDR 0x60
//Sinewave Tables were generated using this calculator:
//http://www.daycounter.com/Calculators/Sine-Generator-Calculator.phtml
int lookup = 0;//varaible for navigating through the tables
int sintab2[131300]=
{
/* This is where I put my list. */
};
void setup()
{
Wire.begin();
// Set A2 and A3 as Outputs to make them our GND and Vcc,
//which will power the MCP4725
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
digitalWrite(A2, LOW);//Set A2 as GND
digitalWrite(A3, HIGH);//Set A3 as Vcc
}
//---------------------------------------------------
void loop()
{
Wire.beginTransmission(MCP4725_ADDR);
Wire.write(64); // cmd to update the DAC
Wire.write(sintab2[lookup] >> 4); // the 8 most significant bits...
Wire.write((sintab2[lookup] & 15) << 4); // the 4 least significant bits...
Wire.endTransmission();
lookup = (lookup + 1) & 147454;
}
为什么我收到此错误,python shell告诉我我的列表长度为131300。
DAC_SINE.cpp:6607:1: error: too many initializers for 'int [16383]'
如果需要,我可以发布我的清单。我输入daycounter.com计算器的值为131299,点数为4095,最大振幅为4095,每行为20,十进制格式。请帮忙。