0

I have a file with colour values for my led strip. When I try to change some values it just appends them to the end of the file. After some trying and testing I found out that seek jumps to the end of the file instead of the position I tell it to jump to. It used to work a few month ago, but after picking up the project again it broke. I did try a few older Arduino versions, but that didn't fix it or raised different errors.

the code for changing values:

sdFile = SD.open(F("PIXELS1.BIN"), FILE_WRITE);
if (!sdFile) {
    error(F("SD CAN'T OPEN FILE"));
}

sdFile.seek(ledArray[0]*3);
for(int i=ledArray[0];i<=ledArray[1];i++) {
    sdFile.write(colorArray, sizeof(colorArray));
}
sdFile.close();
halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

solved it by using an older SD lib version