My goal is to use sdFat library, more precisely AnalogBinLogger example.

I want to log data from changing analog pins for example, I want to log from pin 0 to pin 3 for 5 minutes and then from pin 4 to pin 6 for another 5 mins and then from pin 7 to pin 9 for another 5 mins. that is going to be continuously which means I am going to get rid of the part where you have to enter "r" to start logging.

Regarding the time, I managed to figure it out, I am just using the value of the variable count, if my sampling rate is 1000 samples/sec for example then 5 minutes will be 1000*60*5 and the change will be done in this line:

if (Serial.available()) {
  // Stop ISR calls.


if (count >1000*60*5) {
  // Stop ISR calls.

and this worked fine.

My problem is with the changing pins:

const uint8_t PIN_LIST[] = {1};

I changed this line to

uint8_t PIN_LIST[3] = {};

First I removed the word const, because it's not going to be constant anymore, and I just declared an empty array, and second I am changing the pins in the loop.

Here is the loop after I got rid of doing the serial input:

void loop(void) {
int i;
for (i=0;i<=12;i+3)
  PIN_LIST[] = {i,i+1,i+2};

The problem is I get this error :

  1. AnalogBinLogger.ino: In function 'void loop()':
  2. AnalogBinLogger:808: error: expected primary-expression before ']' token
  3. AnalogBinLogger:808: error: expected primary-expression before '{' token
  4. AnalogBinLogger:808: error: expected `;' before '{' token

The line 808 is:

PIN_LIST[] = {i,i+1,i+2};

So this is the only error, any help please?

The code is so long (800+ lines) if this information is not enough and you need me to explain a part then just tell me.

1 Answer 1


in case someone has the same problem it seems like after you initialize an array this way

uint8_t PIN_LIST[3] = {};

you won't be able to assign all the values at once:

PIN_LIST[] = {i,i+1,i+2};
instead you assign each individual value

  • PIN_LIST[0] = i;
  • PIN_LIST[1] = i+1;
  • PIN_LIST[2] = i+2;

and now it worked : )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.