I have a project in which there are two buttons: forwards and back. Every time the forwards button is pressed, a variable, i is incremented by 1 (i++) and every time the back button is pressed, it unincrements by 1 (i--). It is automatically set to 0 in the setup after each power up. How can I use EEPROM to remember the value of that int and automatically set the variable as that value every time the arduino is powered up?
Look at the EEPROM libary.
It store bytes. Split ints into two bytes and write them sepratly. Then read them back as two bytes and combin them using the shift operator on the most significant byte and OR it with the least significant byte.
note that EEPROM has a large but limited amount of writes (100.000)
so if your project is going up to those numbers (over its lifetime) you might need a different solution.