Update README.md
This commit is contained in:
1 parent
65cd974ec9
commit
0f0c451e14
1 file changed
+6
-11
@@ -84,26 +84,21 @@ time_now = output->tmst
|
|||||||
for train in output->ctatt->route->0->train:
|
for train in output->ctatt->route->0->train:
|
||||||
# 'train' will now refer to the first train in the folder, aka 0.
|
# 'train' will now refer to the first train in the folder, aka 0.
|
||||||
# So we can save the next stop of the train
|
# So we can save the next stop of the train
|
||||||
statiom_eta[next_stop] = train->nextStaId
|
next_stop = train->nextStaId
|
||||||
|
|
||||||
# The time of the next stop
|
# The time of the next stop
|
||||||
time_to_stop = train->arrT
|
station_eta[next_stop] = train->arrT
|
||||||
# Get the time difference.
|
|
||||||
time_eta = time_to_stop - time_now
|
|
||||||
# In our made up language, this is going to be in seconds.
|
|
||||||
time_eta_mins = time_eta / 60
|
|
||||||
|
|
||||||
# Now we can update the station array from earlier
|
|
||||||
stations_eta[next_stop] = time_eta_mins
|
|
||||||
|
|
||||||
# The loop will now run again, but next time it will refer to the second train (aka 1)
|
# The loop will now run again, but next time it will refer to the second train (aka 1)
|
||||||
|
|
||||||
# We now have an array of all stations and the next train to arrive at them. For the ones with none any time soon, they'll still be 999 minutes away.
|
# We now have an array of all stations and the next train to arrive at them. For the ones with none any time soon, they'll still be 999 minutes away.
|
||||||
print(stations_eta[40380])
|
print(stations_eta[40380])
|
||||||
---> 6
|
---> 2026-06-06 12:11:14
|
||||||
|
|
||||||
print(stations_eta[40390])
|
print(stations_eta[40390])
|
||||||
---> 11
|
---> 2026-06-06 12:13:14
|
||||||
|
|
||||||
|
# This data can now be used to toggle LEDs based on the desired behavior.
|
||||||
```
|
```
|
||||||
|
|
||||||
### ESP32 Implementation
|
### ESP32 Implementation
|
||||||
|
|||||||
Reference in new issue
Block a user