You can only initialize an array when you declare it. Hard to say how it could have compiled previously. Easy enough to fix by moving the ={1,2}; to the declaration though.
I do. You are mistaken in what code you were running before. That code, as shown, is not legal C code. It can't have ever worked, and it will never work.
You can only assign the contents of an array when you declare the array. At any other time you have to manipulate it one element at a time. The following is legal:
int chaine[2]={1,2};
void setup() {}
void loop(){}
measurement.ino: In function 'void loop()':
measurement:21: error: assigning to an array from an initializer list
assigning to an array from an initializer list
Your code is good and uploaded well, but i need the output data as output of the above mentioned program.
It is leading to some more errors as the function i declared accepts only (int*)
Could you suggest me to get rid of above error for my code.
Please download library for Support Vector Machine Library from below link.
I would like to read 5 sensors data and i need to classify.
"measurement.ino" is meant for reading the data from arduino, if i try to implement that program it is not accepting the output arrays of analog readings.
I would like to read 5 sensors data and i need to classify.
"measurement.ino" is meant for reading the data from arduino, if i try to implement that program it is not accepting the output arrays of analog readings.
Quit the mumbo-jumbo - post your code (use code tags) and post the exact error message you're seeing.
In file included from sketch_svm.ino:1:0:
sketch_svm.ino: In function 'void svm_predict(int*)':
C:\Program Files\Arduino\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:78:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define pgm_read_word(addr) (*(const unsigned short )(addr))
^
sketch_svm.ino:59:35: note: in expansion of macro 'pgm_read_word'
C:\Program Files\Arduino\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:78:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define pgm_read_word(addr) ((const unsigned short )(addr))
^
sketch_svm.ino:60:35: note: in expansion of macro 'pgm_read_word'
C:\Program Files\Arduino\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:78:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define pgm_read_word(addr) ((const unsigned short )(addr))
^
sketch_svm.ino:61:35: note: in expansion of macro 'pgm_read_word'
C:\Program Files\Arduino\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:78:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define pgm_read_word(addr) ((const unsigned short *)(addr))
^
sketch_svm.ino:62:34: note: in expansion of macro 'pgm_read_word'
measurement.ino: In function 'void loop()':
measurement:22: error: assigning to an array from an initializer list
assigning to an array from an initializer list
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Why don't you use an array in a way it is supposed to be used? Maybe reading a book on the C basics will help
#include <avr/pgmspace.h>
// In this section you should implement the handling of your sensor data, which you would like to classify.
// and an example would be:
int sensors[5];
void setup() {
Serial.begin(115200);
}
void loop() {
sensors[0] = analogRead(0);
sensors[1] = analogRead(1);
sensors[2] = analogRead(2);
sensors[3] = analogRead(3);
sensors[4] = analogRead(4);
delay(600);
svm_predict(sensors);
}
Your code is more than likely also missing an include statement in the beginning and hence the compiler does not know svm_predict.
PS
Next time, please post code between [code] and [/code] and not in quotes; makes it easier to copy. Same applies for error messages. Thank you.
Note: I did not look at other errors as I did not get them with the above code; compiled with IDE 1.6.6 on Windows 8.
I am not blaming the recent versions but
i was using arduino 1.6.0 and installed many third party libraries.
I upgraded to 1.6.7 and it was showing many of the libraries are invalid.
I thought this would be the reason for getting errors when run my programs. :o