Start in the same state after turning the power off and on

Hi @Jan123456;
put a Serial.println(state,HEX); after the line
States = dueFlashStorage.read(0);
and tell us what was printed.
Ops. Put Serial.begin (19200); in the setup() first line.
RV mineirin