Project

pixoo

0.01
No release in over 3 years
This is just a Ruby client for Pixoo displays
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.0
~> 13.0

Runtime

>= 0.3.0
>= 2.18.0
>= 0.9.1
>= 3.2.2
 Project Readme

Pixoo sign client for Ruby

This is just a client for the Pixoo 64 sign written in Ruby.

Example usage

Draw some stuff and then display it as an animated image:

include Pixoo::Utils

images = [7, 17, 29].map { |m|
  img = Pixoo::ImageBuffer.new 64, speed: 500
  64.times do |x|
    64.times do |y|
      if ((x | y) % m).zero?
        img.set_pixel x, y, *(rainbow_color(x))
      end
    end
  end
  img
}

dev = Pixoo::Client.find_all.first
dev.send_animation images
sleep 1

# add some text
dev.send_text "Hello", x: 0, y: 0, id: 1
dev.send_text "World", x: 0, y: 40, id: 2, font: 6

Read a PNG and display it:

img = Pixoo::ImageBuffer.from_png ARGV[0]

dev = Pixoo::Client.find_all.first
dev.send_animation [img]

Reading from a remote server

This thing supports reading values from a remote server. I have a server that collects PM2.5 / CO2 sensors I have in the house. On the server, I have a webrick server that response to requests for sensor info. For example to get the PM2.5 data from my office, I can do this:

$ curl 'http://tender.home:9292/reading?floor=main&room=office&measurement=pm2.5'
{"DispData":"25"}

The response is important because this display will parse the response and display it on the sign. I've configured the sign as follows:

dev = Pixoo::Client.find_all.first

label = dev.new_display_item(id: 1,
  type: Pixoo::DisplayItem::TEXT_MESSAGE,
  x: 0,
  y: 0,
  dir: 0,
  font: 18,
  width: 64,
  height: 5,
  string: "PM2-5:",
  speed: 10,
  color: "#FF0000",
  align: 1)

value = dev.new_display_item(id: 2,
  type: Pixoo::DisplayItem::NET_TEXT_MESSAGE,
  x: 23,
  y: 0,
  dir: 0,
  font: 18,
  width: 64,
  height: 5,
  string: "http://tender.home:9292/reading?floor=main&room=office&measurement=pm2.5",
  speed: 10,
  color: "#FFFFFF",
  align: 1)

The sign will automatically fetch data from my server and update the display.