What “code” develops in the camp? What were punishments for breaking it?
The "code" that develops in the camps is outlined in Chapter 22. The migrants who have made Weedpatch their home have decided that justice and care will only be accomplished by their own kind. The punishment is explusion from the community, one of the many instances of the "Grapes of Wrath" to which the title refers.
As the Joads creak towards the entrance, the watchman tells them what they can expect and how the camp is governed:
"Well, the camp costs a dollar a week but you can work it out, carrying garbage, keeping the camp clean, stuff like that." (This is important for the dignity of the people, who shun charity and want to feel like they are earning their keep and are valued members of a community.)
When Tom asks what happens when a member breaks the rules, the watchman continues: "Well, you can vote 'em out jus' as quick as you can vote 'em in. They've done a fine job. Tell you what they did-- you know the Holy Roller preachers all the time follow the people around, preachin' and takin' up collections? Well they wanted to preach in this cam....So it was up to the Central Commitee. They went into the meeting and here's how they fixed it. They say, 'Any preacher can preach in this camp. Nobody can take up a collection in this camp.' And it's been kinda sad for the old folks, 'cause their hasn't been a preacher since." (This is democracy in action, and the people make and keep their laws.)
The codes were rules and rights of the migrants. When they stopped for the night, families became a part of a larger community that observed rules, proper behavior, and respect. Equality was important. If you knew where the closest water source was, you passed along the information and you did not steal from one another.
The penalty for breaking these codes was either being ostracized by the other families, or an act of violence.