Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement the light class to use GPIO #327

Open
cal-pratt opened this issue Jun 19, 2017 · 0 comments
Open

Re-implement the light class to use GPIO #327

cal-pratt opened this issue Jun 19, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@cal-pratt
Copy link
Contributor

cal-pratt commented Jun 19, 2017

Instead of a Maestro for lights we're going to use a GPIO.

Steps:

  • Remove the existing Light class and and tests from the project.
  • Create a Light interface in the devices package. The flash method should do the same thing as the existing light class; just change between on/off at the same frequency.
public interface Light {
    void write(final boolean active);
    void flash();
}
  • Implement the interface using a pi4j gpio object. Place this in the io.rpi package. Some name like RaspberryGpioLight
  • Add the light channel to the config.
  • Add the light to the Rov ctor and manage.

SpeedValue no longer really works; the value is a boolean not a float range. For now you can just map the speedvalue to a boolean, until you recreate the lights value fully.

eventPublisher.valuesOfType(LightASpeedValue.class)
    .startWith(new LightASpeedValue())
    .map(SpeedValue::getSpeed)
    .map(v -> v > 0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants