summaryrefslogtreecommitdiff
path: root/src/testApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testApp.cpp')
-rw-r--r--src/testApp.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/testApp.cpp b/src/testApp.cpp
index a7b90d1..afaaad0 100644
--- a/src/testApp.cpp
+++ b/src/testApp.cpp
@@ -39,8 +39,8 @@ void testApp::setup(){
transTime=0;
transition=false;
- whichClip=1; //0 is black
- switchClip=1; //0 is black
+ whichClip=0; //0 is black
+ switchClip=0; //0 is black
texture.loadMovie(clips[whichClip]);
texture.setLoopState(OF_LOOP_NORMAL);
texture.play();
@@ -62,11 +62,10 @@ void testApp::setup(){
videoInverted = new unsigned char[camWidth*camHeight*3];
videoTexture.allocate(camWidth,camHeight, GL_RGB);
- ard.connect("/dev/ttyUSB0", 57600);
- ofAddListener(ard.EInitialized, this, &testApp::setupArduino);
- bSetupArduino = false;
+ bSetupArduino = ard.connect("/dev/ttyUSB0", 57600);
+ if (bSetupArduino) ofAddListener(ard.EInitialized, this, &testApp::setupArduino);
bSwitchArduino = false;
-
+
//----------------avahi stuff
avahiService.start("ofMrmr","_mrmrsrvr._udp",1337);
oscReceiver.setup(1337); //default mrmr port
@@ -77,7 +76,7 @@ void testApp::setup(){
void testApp::update(){
texture.idleMovie();
calibrator_label.idleMovie();
-
+
//mixAmount=sin(ofGetElapsedTimef())+1.0;
doTransition();
@@ -97,7 +96,7 @@ void testApp::update(){
}
}
updateArduino();
-
+
//----------------avahi stuff
ProcessMessages();
}
@@ -114,20 +113,22 @@ void testApp::setupArduino(const int & version) {
}
ard.sendDigitalPinMode(7, ARD_INPUT);
- bSetupArduino = true;
+
printf("arduino ready\n");
}
//--------------------------------------------------------------
void testApp::updateArduino(){
- // update the arduino, get any data or messages.
- ard.update();
+
// do not send anything until the arduino has been set up
if (bSetupArduino) {
-
-
+
+ // update the arduino, get any data or messages.
+ ard.update();
+
+
if (bSwitchArduino!=ard.getDigital(7)) {
bSwitchArduino=ard.getDigital(7);
printf("pin 7 %i\n",bSwitchArduino);
@@ -140,7 +141,7 @@ void testApp::updateArduino(){
whichClip=0;
transTime=ofGetElapsedTimef()+0.1;
}
-
+
transition=true;
}
}
@@ -201,7 +202,7 @@ void testApp::ProcessMessages(){
{
int ls = messageAddress.find_last_of("/");
int msg=-1;
-
+
if(m.getNumArgs()) msg=m.getArgAsInt32( 0 );
if(startswith(messageAddress.c_str(),"/mrmr/pushbutton/1"))
@@ -410,8 +411,8 @@ void testApp::loadSettings(string filename){
}
//numViews=2;
- //views[0].setup(ofGetWidth()/2,ofGetHeight(),0,0);
- //views[1].setup(ofGetWidth()/2,ofGetHeight(),ofGetWidth()/2,0);
+ //views[0].setup(ofGetScreenWidth()/2,ofGetScreenHeight(),0,0);
+ //views[1].setup(ofGetScreenWidth()/2,ofGetScreenHeight(),ofGetScreenWidth()/2,0);
//activeView=0;
}
//--------------------------------------------------------------