A Localized Slot Allocation Algorithm for Wireless Sensor Networks