Ruby的Pixoo Sign客户端
Pixoo Sign Client for Ruby

原始链接: https://github.com/tenderlove/pixoo-rb

这个 Ruby 客户端允许用户控制和显示 Pixoo 64 标志上的内容。它支持多种显示选项:创建具有自定义像素图案和彩虹色的动画图像,显示静态 PNG 图像,以及显示文本。 一个关键特性是从远程服务器(在这种情况下,提供 PM2.5 和 CO2 传感器读数的 Webrick 服务器)获取数据。客户端可以解析服务器的 JSON 响应,并使用实时信息(例如当前的 PM2.5 浓度)动态更新 Pixoo 64 显示屏。 配置涉及定义显示项(文本、网络来源文本),并指定位置、字体、颜色和数据源 URL 等属性。标志会自动轮询服务器并相应地更新显示,提供动态信息显示解决方案。

发布了一个新的Pixoo LED标牌Ruby客户端(github.com/tenderlove),在Hacker News上引发了讨论。该客户端允许对这些显示屏进行程序化控制,为定制标牌提供了可能性。 用户正在探索在制造业中的应用——显示机器数据和工作信息,作为替代脆弱、较旧的基于串行系统的方案。一个主要关注点是更新速度;虽然蓝牙版本较慢,但WiFi型号是否能够处理频繁更新也受到质疑。 一位用户分享了一个个人项目,使用类似的显示屏作为时钟/气象站(ryanmpoe.com/2026-01-03-weather-pixel-art/),突出了其在创意应用方面的潜力。总的来说,这次讨论表明人们对这些LED显示屏作为各种信息和艺术用途的强大且视觉上吸引人的解决方案很感兴趣。
相关文章

原文

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

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.

联系我们 contact @ memedata.com