Giter VIP home page Giter VIP logo

java-rpi-rgb-led-matrix's Introduction

java-rpi-rgb-led-matrix

Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO by java

貌似每找到java操作彩色LED屏幕的,我也在原项目的issue上问过作者可不可以出一个"java binding",有go bindng, c#binding,甚至还有node binding,就是没有java binding,看样子java不受作者待见。

java binding

本人java出身,对c++不甚了解,所以照猫画虎跟着c#binding写了一个java binding简易版。过去了很长时间我也用了很久,回过头来发现源码找不到了,所以只能上传三个文件。有兴趣的可以自己将它们打包到jar里实现引入即可使用。

说明

1、拷贝Canvas.java类到自己的项目; 2、将两个so文件放到项目根目录或自己喜欢的目录 3、加入如下代码:

static {
    System.load(new File("lib/librgbmatrix.so.1").getAbsolutePath()); //目录自己看着办
    System.load(new File("lib/libuntitled.so").getAbsolutePath()); //目录自己看着办
    Canvas.init(32, 64, true);
}

4、使用示范

//这是示范代码,如果在static中引入了则不需要这里再写一遍。
System.load(new File("lib/librgbmatrix.so.1").getAbsolutePath());
System.load(new File("lib/libuntitled.so").getAbsolutePath());
Canvas.init(32, 64, true);

Canvas.clear();
for (int i = 0; i < points.length; i++) { //points为提前准备好的所有点
    int color = points[i];
    if (color == 0) {
        continue;
    }
    Canvas.setPixel(i % 64, i / 64, getR(points[i]), getG(points[i]), getB(points[i])); //设置坐标填充RGB颜色,换成自己的坐标和颜色即可
}
Canvas.swap();
Thread.sleep(5000)
Canvas.destroy();

java-rpi-rgb-led-matrix's People

Contributors

shisanxing avatar

Watchers

 avatar

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.