Git Product home page Git Product logo

grovepi's Issues

Separate LCD and Coloring into two devices

There are two different addresses and devices that makeup RGBLCD. I believe that they would be better served by splitting them into two modules. We can still have the top level module that would just pass through to the other two devices.

Should we keep polling

Polling gives us a friendly interface for sending event and messages, but it also limits some of the more advanced work that someone may want to do with their systems. It also defines the controls that an end user has when using the library.

For 1.0 should we pull the polling out into a new GenServer for end-user use? Should we drop it entirely? Should we keep it the same as it is?

Support sensors without polling

Some sensors we might want to have polling only part of the time. Like the DHT. I think the DHT is a good candidate to have polling so that events can be fired when a certain humidity is reached, like in a dehumidifier. Sometimes, for resource management or other applications we may not want a continuous polling. I propose that we allow a poll_interval of 0 to be passed to any sensor and have that sensor only work with read. We can even have a stop function that sets the polling interval to 0 so that after the next poll it will not poll any more. There could also be a start_polling function that takes in a new poll_interval and starts up the polling again.

Thoughts?

GrovePi.Analog.write/2 results in error

I am trying to implement this project: https://github.com/DexterInd/GrovePi/blob/master/Projects/LED_Fade/led_fade.py

# Connect the LED to digital port D5
led = 5
grovepi.pinMode(led,"OUTPUT")

# Where i is the output of the potentiometer.
grovepi.analogWrite(led,i//4)

I'm just trying to get the led to work by itself. I have an led board connected to port D5.

Looking at the GrovePi.Analog docs, I should just be able to call:

GrovePi.Analog.write(5, 200)

However, I get this error:

fe423e:        00:04:53.474 [error] GenServer Default.Elixir.GrovePi.Board terminating
** (MatchError) no match of right hand side value: :error
    (elixir_ale) lib/elixir_ale/i2c.ex:171: ElixirALE.I2C.handle_call/3
    (stdlib) gen_server.erl:615: :gen_server.try_handle_call/4
    (stdlib) gen_server.erl:647: :gen_server.handle_msg/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: {:write, <<4, 5, 200, 0>>}
State: %ElixirALE.I2C.State{address: 4, devname: "i2c-1", port: #Port<0.971>}
fe423e:        00:04:54.052 [error] GenServer {Default.Elixir.GrovePi.Registry.Pin, 14} terminating
** (stop) exited in: GenServer.call(Default.Elixir.GrovePi.Board, {:write, <<1, 14, 0, 0>>}, 5000)
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: :error
            (elixir_ale) lib/elixir_ale/i2c.ex:171: ElixirALE.I2C.handle_call/3
            (stdlib) gen_server.erl:615: :gen_server.try_handle_call/4
            (stdlib) gen_server.erl:647: :gen_server.handle_msg/5
            (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
    (elixir) lib/gen_server.ex:737: GenServer.call/3
    (grovepi) lib/grovepi/board.ex:80: GrovePi.Board.send_request_with_retry/3
    (grovepi) lib/grovepi/digital.ex:34: GrovePi.Digital.read/2
    (grovepi) lib/grovepi/poller.ex:135: GrovePi.Button.update_value/1
    (grovepi) lib/grovepi/poller.ex:128: GrovePi.Button.handle_info/2
    (stdlib) gen_server.erl:601: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:667: :gen_server.handle_msg/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: :poll_button
State: %GrovePi.Button.State{pin: 14, poll_interval: 100, poll_reference: #Reference<0.0.1.2292>, prefix: Default, trigger: GrovePi.Button.DefaultTrigger, trigger_state: %GrovePi.Button.DefaultTrigger.State{value: 0}}

Do I need to do something else before the GrovePi.Analog.write/2 function call? Do I need to set the pin mode? Or am I doing something else wrong?

Add sound module support

I started working on this, but wanted to refactor to add triggers first. When looking at this the Button and Sound will be so similar that I think I'm going to try to pull out a polling module that they both use.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.