Fast&simple streaming from PC screen to 32x32 matrix
Posted: Thu Feb 20, 2014 10:09 pm
Hi!
I didn't find a simple example to stream live data from my PC screen to the 32x32 panel using an Arduino. Therefore I hacked a small sketch and a Java app that allows streaming with about 12fps. The Java app captures a specific part on the screen (defined with a movable, transparent, window), and prepares the matrix buffer. To reduce the work on the Arduino as much as possible, I have ported some parts of the Adafruit Matrix Library to Java, and perform them on the PC. Hardware setup is equivalent to the Adafruit tutorial.
Here's a video:
http://www.youtube.com/watch?v=BANNED ... e=youtu.be
The Sketch:
And here is the Java app. Just start the jar in the bin directory. Move&Scale the small window to define what to stream. Click "enable output" to start streaming.
https://dl.dropboxusercontent.com/u/170 ... Stream.rar

I didn't find a simple example to stream live data from my PC screen to the 32x32 panel using an Arduino. Therefore I hacked a small sketch and a Java app that allows streaming with about 12fps. The Java app captures a specific part on the screen (defined with a movable, transparent, window), and prepares the matrix buffer. To reduce the work on the Arduino as much as possible, I have ported some parts of the Adafruit Matrix Library to Java, and perform them on the PC. Hardware setup is equivalent to the Adafruit tutorial.
Here's a video:
http://www.youtube.com/watch?v=BANNED ... e=youtu.be
The Sketch:
Code: Select all
// Fast Serial Screen Streaming, written by Markus Lipp, based on examples from AdaFruit
// BSD license, all text above must be included in any redistribution.
#include <Adafruit_GFX.h> // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library
#define CLK 11 // MUST be on PORTB! (Use pin 11 on Mega)
#define OE 9
#define LAT 10
#define A A0
#define B A1
#define C A2
#define D A3
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false);
int pos=0;
uint8_t* buffer;
int bufferLength;
void setup() {
matrix.begin();
Serial.begin(250000);
pos=0;
bufferLength = 1536;
buffer = matrix.backBuffer();
}
byte prevVal,val;
void loop() {
if (Serial.available())
{
prevVal = val;
val = Serial.read();
//prepare RGB-Matrix buffer (including gamma correction) directly on PC and stream
if ( (prevVal==0x21 && val==0x8) //magic numbers
|| pos>=bufferLength)
{
pos=0;
} else
{
buffer[pos++]=val;
}
}
}
https://dl.dropboxusercontent.com/u/170 ... Stream.rar
