The narrator has been sentanced to death. He is very fearful.
The narrator is put in a nearly completely dark cell, unable to see anything he wanders around, trying to get a feel of how large his cell is. He finds that there is a giant pit in the middle of his cell.
The narrator found some food, but soon passed out. As soon as he wakes up he realizes that he is tied to a board with a pendulum swinging overhead.
The rats ate through the strap holding the narator, freeing them from the pendulum.
Not long after the narator is free of the pendulum the walls start to close, pushing the narator closer to the pit.
The narrator is freed after the french liberate the prison, right before the walls got too close and pushed him in the pit.