The fact that the code is so simple and it "doesn't work" probably means your wiring is wrong. Did you use current limiting resistors with your LEDs? Are they wired the right way around?
The fact that the code is so simple and it "doesn't work" probably means your wiring is wrong. Did you use current limiting resistors with your LEDs? Are they wired the right way around?