Use the code in room 1 to open the chest in room 2, you can get a key to open the room door. After a few repetitions you will see ending 2.