Process
To work as an ambient display and remind my roommate the coming of the bus, the device should have the following functions:
1.Collect the data of the bus route at the stop near our apartment from an api.
2.Grab the predicted arrival time of the next bus from the raw data.
3.Use light behavior to remind my roommate of the coming before it arrival.
4.If it is too late for them to catch the bus, there is no need to remind them.
5.When there is no bus coming in a period, the device should not catch too much attention
I use the official Port Authority api to get the predicted arrival time of the bus 71D at the stop around our apartment. In the code I set the device to get the data from the api in every two minutes and compare the arrival time (in what minutes the bus will arrive) with 12 minutes, because it usually takes us 10 minutes to walk to the bus stop. If a bus is coming, the led light will flash in red. If there is no bus coming, the led will fade from red to green to blue and go back to red. And if there is only 6 minutes before the bus arrives, the led light will go back to normal state. There is no way we can catch a bus in 6 minutes, even if we rush to the stop.