added entec driver and OLA test programs

master
Bartosz Kostrzewa 2011-05-12 20:56:38 +02:00
parent 757ed7604a
commit 1654d20ead
7 changed files with 107 additions and 0 deletions

@ -0,0 +1 @@
Subproject commit 3253e7b6ef906ce78e423245925f658cba35530a

BIN
ola-test/blackout Executable file

Binary file not shown.

47
ola-test/blackout.cpp Normal file
View File

@ -0,0 +1,47 @@
#include <iostream>
#include <stdlib.h>
#include <ola/DmxBuffer.h>
#include <ola/Logging.h>
#include <ola/StreamingClient.h>
#include <math.h>
#include <iostream>
using std::cout;
using std::endl;
int main(int argc, char *argv[]) {
unsigned int universe = 0; // universe to use for sending data
unsigned int i;
// turn on OLA logging
ola::InitLogging(ola::OLA_LOG_WARN, ola::OLA_LOG_STDERR);
// Create a new DmxBuffer to hold the data
ola::DmxBuffer buffer;
// set all channels to 0
buffer.Blackout();
// create a new client and set the Error Closure
ola::StreamingClient ola_client;
// Setup the client, this connects to the server
if (!ola_client.Setup()) {
cout << "Setup failed" << endl;
exit(1);
}
// send the data to the ola server
if (!ola_client.SendDmx(0, buffer)) {
cout << "Send DMX failed" << endl;
exit(1);
}
// close the connection
ola_client.Stop();
return 0;
}

View File

@ -0,0 +1 @@
g++ -I/usr/local/include/libola -L/usr/local/lib -lola -lolacommon -lprotobuf blackout.cpp -o blackout

1
ola-test/compile.sh Normal file
View File

@ -0,0 +1 @@
g++ -I/usr/local/include/libola -L/usr/local/lib -lola -lolacommon -lprotobuf flash.cpp -o flash

BIN
ola-test/flash Executable file

Binary file not shown.

57
ola-test/flash.cpp Normal file
View File

@ -0,0 +1,57 @@
#include <iostream>
#include <stdlib.h>
#include <ola/DmxBuffer.h>
#include <ola/Logging.h>
#include <ola/StreamingClient.h>
#include <math.h>
#include <iostream>
using std::cout;
using std::endl;
int main(int argc, char *argv[]) {
unsigned int universe = 0; // universe to use for sending data
unsigned int i;
// turn on OLA logging
ola::InitLogging(ola::OLA_LOG_WARN, ola::OLA_LOG_STDERR);
// Create a new DmxBuffer to hold the data
ola::DmxBuffer buffer;
// set all channels to 0
buffer.Blackout();
// create a new client and set the Error Closure
ola::StreamingClient ola_client;
// Setup the client, this connects to the server
if (!ola_client.Setup()) {
cout << "Setup failed" << endl;
exit(1);
}
// send the data to the ola server
double t = 0.0;
while(1) {
t += 0.1;
buffer.SetChannel(4, (int)(127+128*sin(t)));
buffer.SetChannel(5, (int)(127+128*cos(t/4)));
//for(int j = 0; j < 255; j++) {
if (!ola_client.SendDmx(0, buffer)) {
cout << "Send DMX failed" << endl;
exit(1);
}
usleep(20000); // sleep for 20ms between updates
//cout << "universe " << j << endl;
//}
}
// close the connection
ola_client.Stop();
return 0;
}