Skip to content

Circularbuffer vs EEPROM.read/write #31

Answered by rlogiacco
Francois1976 asked this question in Q&A
Discussion options

You must be logged in to vote

The message is quite obvious, but to put it simple, you are trying to treat the buffer as if it was an array and use the [] to identify an item in the buffer and perform an assignment: that is not going to work.

The [] operator can be used to read data from the buffer, not to perform assignments, that is why you find the [] operator listed in the retrieve data section of the readme but not in the store data.

What you can do is replace your

// this cannot work because the left operand is not assignable (lvalue)
buffer[0]=EEPROM.read(0);
buffer[1]=EEPROM.read(1);
buffer[2]=EEPROM.read(2);

with

// this works because we are appending to the buffer
buffer.push(EEPROM.read(0));
buffer.push(EEP…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rlogiacco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #31 on December 12, 2020 14:18.