ofVideo with Arduino + Peltier cell:issue on playing video

Hi everyone,

I’m trying to use Peltier cell as video controller. while you touch it, video plays on openFrameworks.

it’s almost working, but after pushing start button video plays for 3-5 second then it works perfectly. I have no idea why it’s happen. could you help to fix this problem?

here is video which shows this problem

my header code is as following

#pragma once

#include "ofMain.h"
//#include "ofEvents.h"

#define NUM_PARTICLES 30000
class ofApp :smile:
public ofBaseApp{
 
public:
    
    void setup();
    void update();
    void draw();
    
    
    
    void setupArduino(const int & version);
    void updateArduino();
    
    ofVideoPlayer fingersMovie;
    
    ofArduino ard;
    bool bSetupArduino;
    
    bool isStarted;
};

and here is main code

#include "ofApp.h"



//--------------------------------------------------------------

void ofApp::setup(){
    ofSetVerticalSync(true);
    ofSetFrameRate(60);
    ofBackgroundHex(0x000000);
    
    ofBackground(0,0,0); ofEnableSmoothing(); //画面の混色の設定を加算合成にする
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    fingersMovie.loadMovie("fingers.mov");
    //fingersMovie.play();

    ard.connect("/dev/tty.usbmodem1411", 57600);
    ofAddListener(ard.EInitialized, this, &ofApp::setupArduino);
    bSetupArduino	= false;
    
}



//--------------------------------------------------------------

void ofApp::update(){
    
    fingersMovie.update();
    updateArduino();
    
}



//--------------------------------------------------------------

void ofApp::setupArduino(const int & version) {

    ofRemoveListener(ard.EInitialized, this, &ofApp::setupArduino);
    

    for (int i = 0; i < 6; i++) {
        
        ard.sendAnalogPinReporting(i, ARD_ANALOG);
        
    }
    
    
    
    // 接続の確立のフラグをtrueに
    
    bSetupArduino = true;
    
}



//--------------------------------------------------------------

void ofApp::updateArduino(){
    
    ard.update();
    
}



//--------------------------------------------------------------

void ofApp::draw(){
    
    int input = ard.getAnalog(0);
    fingersMovie.draw(20, 100);
    //温度によって数字を変える
    if(input > 3 ){
        fingersMovie.play();
    } else {
        fingersMovie.setPaused(true);
    }
    
    
    //デバッグ用
    if (bSetupArduino){
        
        string msg = "";
        
        for (int i = 0; i < 6; i++) {
            msg += "Analog IN " + ofToString(i, 0)
            + " : " + ofToString(ard.getAnalog(i), 0) + "\n";
        }
        
        ofSetHexColor(0xFFFFFF);
        ofDrawBitmapString(msg, 20, 20);
    }
}

Thanks,