Skip to content

Commit

Permalink
Push color to Neopixel
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Rees committed Feb 23, 2017
1 parent cbd49db commit 22c4dfd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 33 deletions.
8 changes: 4 additions & 4 deletions apps/zapdos/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use Mix.Config
# import_config "#{Mix.env}.exs"

config :extwitter, :oauth, [
consumer_key: "",
consumer_secret: "",
access_token: "",
access_token_secret: ""
consumer_key: "Fw1ddOMbixLPOMWFvP2NZjEX9",
consumer_secret: "2FHB8gEApM9aPwhh0EduwEWz9Yinv5lEKmIDpOVlyJTTB9uK70",
access_token: "17117998-ZDEK0zkSW8mcNJISPRRJwFnMvtkJwccm8Z6EH40ak",
access_token_secret: "yYB8Q8JcVfthIP5TjlL2pYJOQ7qk9UPsLpjp6IaSkpemt"
]
8 changes: 7 additions & 1 deletion apps/zapdos/lib/zapdos.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ defmodule Zapdos do
def get_tweets(query) do
ExTwitter.stream_filter(track: query)
|> Stream.map(fn(tweet) -> tweet.text end)
|> Stream.map(fn(text) -> ColorParsing.get_color(text) |> ColorParsing.hex_to_number |> IO.puts end)
|> Stream.map(&(update_color(&1)))
|> Enum.to_list
end

defp update_color(text) do
ColorParsing.get_color(text)
|> ColorParsing.parse_rgb_hex
|> Lightning.Control.change_color(150)
end

end
25 changes: 0 additions & 25 deletions apps/zapdos/lib/zapdos/pluck.ex

This file was deleted.

1 change: 1 addition & 0 deletions apps/zapdos/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ defmodule Zapdos.Mixfile do
defp deps do
[
{:extwitter, "~> 0.8"},
{:lightning, in_umbrella: true}
]
end
end
3 changes: 0 additions & 3 deletions apps/zeus/lib/zeus.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ defmodule Zeus do
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Zeus.Supervisor]
Supervisor.start_link(children, opts)

:timer.apply_interval(:timer.seconds(15), Zapdos, :get_tweet("#cmm_storm", 1))
|> IO.puts
end

# Tell Phoenix to update the endpoint configuration
Expand Down

0 comments on commit 22c4dfd

Please sign in to comment.