i used capture 5 seconds of data adc sending samples @ 125 sps, translated having array of size 5 * 125. in code looked like:
#define sps 125 #define time 5 char samples[sps * time];
now, capture 2.5 seconds of data , increase adc sampling rate 250 sps. in code looks like:
#define sps 250 #define time 2.5 char samples[sps * time];
but if compiler throws error as:
#901 expression must have integral or enum type main.cpp line 59 c/c++ problem
i'm able understand saying.
but best way overcome situation keeping sps , time definition's usability in mind. mean i've used them in several other places across project , wish keep using them are.
kindly help!
the problem result converted float ( or double ), size of array must integral type. easiest solution suggested @coolguy, can cast int. here example
#define sps 125 #define time 2.5 char samples[ (int)(sps * time) ];