Hi arduino guys, I got this arduino signal generator kit from www.iteadstudio.com The example sketch that is in the documentation for the kit will not upload. there seems to be something wrong with the PORTD=sin_tab* In function void loop() error 'sin_tab' was not declared in this scope error expected ';' before '}' token Here is a copy of the sketch, Can someone please help me with this? I am new to this arduino programing.* Thankyou
*Ken Kubick, AES * void setup() {
*DDRD =0xFF; * } void loop() {
kenkubick:
Hi arduino guys, I got this arduino signal generator kit from www.iteadstudio.com The example sketch that is in the documentation for the kit will not upload. there seems to be something wrong with the PORTD=sin_tab * In function void loop() error 'sin_tab' was not declared in this scope error expected ';' before '}' token Here is a copy of the sketch, Can someone please help me with this? I am new to this arduino programing.* Thankyou
*Ken Kubick, AES * void setup() {
*DDRD =0xFF; * } void loop() {
for (int i=0;i<256;i++)*
PORTD=sin_tab* } [/quote] First off - next time post a link to the product (at least, I think this is what you bought!) - and use the hash tag (#) in the editor to post your code: http://iteadstudio.com/store/index.php?main_page=product_info&cPath=17&products_id=209 http://iteadstudio.com/iforum/viewtopic.php?f=18&t=19*_ Ok - you only have part of the code; the code listed is broken out weird in the comments, etc in that second link; you probably want something closer to this:
_```* *unsigned char sin_tab [256] = {127,130,133,136,139,142,145,148,151,154,157,160,164,166,169,172,175,178,181,184,187,189,192,195,
197,200,202,205,207,210,212,214,217,219,221,223,225,227,229,231,232,234,236,237,239,240,242,243,
244,245,246,247,248,249, 250,251,251,252,252,253,253,253,253,253,254,253,253,253,253,252,252,251,
251,250,249,249,248,247,246,245,243,242,241,239,238,236,235,233,231,230, 228,226,224,222,220,218,
215,213,211,209,206,204,201,199,196,193,191,188,185,182,180,177,174,171,168,165,162,159,156,153,
150,147,144,141,137,134,131,128,125,122,119,116,112,109,106,103,100,97,94,91,88,85,82,79,76,
73,71,68,65,62,60,57,54,52,49,47,44,42,40,38,35,33,31,29,27,25,23,22,20,18,17,15,14,
12,11,10,8,7,6,5,4,4,3,2,2,1,1,0,0,0,0,0,0,0,0,0,0,1,1,2,2,3,4,5,6,7,8,9,10,11,13,14,16,17,19,21,22,24,
26,28,30,32,34,36,39,41,43,46,48,51,53,56,58,61,64,66,69,72,75,78,81,84,87,89,93,96,
99,102,105,108,111,114,117,120,123,127};
void setup() {
DDRD = 0xFF;
}
void loop() {
for (int i = 0; i < 256; i++) {
PORTD = sin_tab[i];
}
}*
``` Note that that is for the 256-step (256 byte) look-up-table (LUT); if you want to use the 512 or 1024 byte LUTs given in that second link, you'll have to substitute the data into the array (and change the array size, and the end value for the for-next loop). The errors you were receiving was because the look-up-table variable "sin_tab" wasn't defined at the top of the code, and there was a missing semicolon after that variable to denote end-of-line (plus the index into the array was missing).