I used three potentiometers as code. RGB LED will change from red to green by turning the corresponding potentiometer to the right angle. Three LEDs should be lighted up in order.
The servo will be turned to unlock the box if the code is correct.
When the box is opened, the photoresistor will trigger the buzzer to sing.