HI to everybody,Here is my problem, When sketch start I load state of four pin from variable stored in eeprom address 0.My problem is that default state is 255, meaning in binary code its 11111111.And because its gsm controled relays, when I upload sketch I get all four relays enabled, and thats not what I want.I want to be by default 240 or 11110000.Here is my code:

OK I can change it, but isn't this a chicken-egg problem.If by default it's 255 and I change it to 240 in setup, and after some time user turn on relay2 (there is power down situation) I save Relay2-ON state to eeprom, and when atmega power on void setup is going to change to 240. And all relays are off again.So this is my real problem.

EEPROM will save your state regardless of whether the chip has power. Let me clarify, you don't want the relays to turn on when power is reset but you want them to save the last state they were in before power was cut?