Nerves at home: Controlling a desk#23
Nerves at home: Controlling a desk#23fhunleth merged 3 commits intofhunleth:masterfrom jjcarstens:master
Conversation
ConnorRigby
left a comment
There was a problem hiding this comment.
Wow this was great! just a couple little things i noticed here.
| tags: ["nerves", "elixir", "uart", "logic analyzer", "elixir-circuits", "gpio"] | ||
| --- | ||
|
|
||
| Use nerves and a little reverse engineering to contorl a motorized desk and |
There was a problem hiding this comment.
| Use nerves and a little reverse engineering to contorl a motorized desk and | |
| Use Nerves and a little reverse engineering to control a motorized desk and |
|
|
||
| It was a bit overwelming and confusing. There were hundreds of messages for just | ||
| simple movements and I was having trouble finding a pattern. I ended up pinging | ||
| the always helpful folks in the [nerves slack channel](https://elixir-lang.slack.com/messages/C0AB4A879/) |
There was a problem hiding this comment.
| the always helpful folks in the [nerves slack channel](https://elixir-lang.slack.com/messages/C0AB4A879/) | |
| the always helpful folks in the [Nerves slack channel](https://elixir-lang.slack.com/messages/C0AB4A879/) |
There was a problem hiding this comment.
Also, can you also add a link to the forum here?
| # setting LOW will move the desk in whatever direction the pin is for | ||
| # Be sure to initialize with HIGH to prevent moving on pin open. | ||
| {:ok, up_pin} = Circuits.GPIO.open(23, :output, initial_value: 1) | ||
| {:ok, down_pin} = Circuits.GPIO.open(24, :output, initial_value: 1) |
There was a problem hiding this comment.
Yay! You're using the new initial_value option.
There was a problem hiding this comment.
Ya, I was the one that wrote it into ElixirALE so was really glad you guys wrote it in new circuits.GPIO...really saved me!
| update the view in real time on the backend when the socket reports height change. | ||
| You can see the reporting code at [here](https://github.com/jjcarstens/desk/blob/master/controller/lib/controller/reporter.ex). | ||
|
|
||
| It's not special, but you can check it out at: https://dudewheresmydesk.live |
|
I also added one more picture and quick snippet showing a final setup in Ready for another 👀 |
|
I merged. Hopefully it renders ok for real and it's ready to be announced... |
|
Oh, and thanks! This is a super awesome post! |
|
It's live. I reread and realized that in my excitement, I skipped over the binary pattern match. In the iex(3)> <<_, _, height::size(16)>> = <<1, 1, 1, 53>>
<<1, 1, 1, 53>>
iex(4)> height
309
iex(5)> height / 10
30.9So in the pattern match part of the function, you can match on |
I've been doing a lot of projects around home using Nerves. Some have been for fun mainly for learning (like this one) and some are to serve a specific purpose.
This was a good learning experience, so thought I should share it. I'm planning on writing more about my other projects as I complete them and problem scope under
Nerves At Home.Let me know what you think