Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Noticed a few bugs:
checked for interrupts after completing the loop
necessary
gitignore.io
Ended out unrolling this into a state machine, mostly just to practice
some rust.
Example run, with debugging enabled:
pi@raspberrypi:~/rust/rustpitrafficlights $ RUST_LOG=debug cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.10s
Running
target/debug/rustpitrafficlights
[2022-02-11T19:13:49Z DEBUG rustpitrafficlights] Red: red: true, amber: false, green: false
[2022-02-11T19:13:52Z DEBUG rustpitrafficlights] RedAmber: red: true, amber: true, green: false
[2022-02-11T19:13:53Z DEBUG rustpitrafficlights] Green: red: false, amber: false, green: true
[2022-02-11T19:13:58Z DEBUG rustpitrafficlights] Amber: red: false, amber: true, green: false
[2022-02-11T19:14:00Z DEBUG rustpitrafficlights] Red: red: true, amber: false, green: false
[2022-02-11T19:14:03Z DEBUG rustpitrafficlights] RedAmber: red: true, amber: true, green: false
[2022-02-11T19:14:04Z DEBUG rustpitrafficlights] Green: red: false, amber: false, green: true
[2022-02-11T19:14:09Z DEBUG rustpitrafficlights] Amber: red: false, amber: true, green: false
[2022-02-11T19:14:11Z DEBUG rustpitrafficlights] Red: red: true, amber: false, green: false
^C[2022-02-11T19:14:14Z DEBUG rustpitrafficlights] All LEDs off