Python code for Raspberry Pi Level Crossing Project