Greg Hogan, 20, the son of a preacher and former president of Lehigh University's class of 2008, was accused of holding up a Wachovia bank on December 9.
He allegedly handed a teller a note demanding money and saying he had a gun.
Hogan got away with $2,871, then drove off with two of his fraternity brothers, according to police. Both said they knew nothing of Hogan's plans, and neither was charged.
Hogan, a cellist, was arrested during orchestra practice the night of the robbery, after he had gone to the movies and eaten pizza with his unsuspecting friends.
He owed $5,000 in debts from playing online poker and later entered a treatment program for gambling addiction, according to his attorney, John Waldron.
"I think this incident was a cry for help from Greg Hogan," Waldron said, noting that Hogan wore no mask and did not actually have a weapon. "He wanted to be caught."
The Rev. Gregory Hogan Sr. said his son completed a 36-day treatment program for gambling addiction and has received a "good bill of health from that."
"Greg is very sorry," said the elder Hogan, who sat next to his son in court with his arm around him. "He's apologized. We're here to support our son. We love him."
Greg Hogan is no longer a student at Lehigh, said school spokeswoman Sarah Cooke. She said she could not comment on any possible school-related discipline because academic records are private.
The elder Hogan said his son hopes to finish his college degree, but did not know when.
Under sentencing guidelines, he faces 22 months to three years in prison at a hearing set for August 17.
Prosecutors say Hogan should get no special treatment, but Waldron said that a sentence of community service would allow his client to help others avoid what he called the nation's epidemic gambling problem.
"People can get help earlier and not go out and rob a bank," he said.
Hogan's plea comes as Congress is debating whether to pass tougher laws to restrict online gambling. On Tuesday, the House passed legislation that would prevent gamblers from using credit cards to bet online and could block access to gambling Web sites.