You are reading a single comment by @lshk and its replies. Click here to read the full conversation.
  • I tried analogWrite() yesterday, but nothing came of it. Perhaps I just made a mistake somewhere.

    // Header data burst
    // Header Burst Timing is 2.4mS
    // Quiet Timing is 600uS
    
    // Send one data burst
    // Burst Timing is 1.2mS
    // Quiet Timing is 600uS
    
    // Send zero data burst
    // Burst Timing is 600uS
    // Quiet Timing is 600uS
    const IR_ANODE = D17;
    const IR_CATHODE = D16;
    
    const IR_FREQ = 40000;
    const pulse_ratio = 0.25;
    
    //....
    
    var run = function () {
    
    //....
      
        let header_pulses = [2.4, 0.6];
        let command_pulses = [1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 0.6, 0.6];
        let address_pulses = [0.6, 0.6, 1.2, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6, 1.2, 0.6];
        let pause = 11;
      
    
        function code(){
            digitalPulse(IR_CATHODE,0,command_pulses);
            digitalPulse(IR_CATHODE,0,address_pulses);
            digitalPulse(IR_CATHODE,1,pause); 
        }
    
        function header(){
          digitalPulse(IR_CATHODE,0,header_pulses);
        }
    
        function shot(){
            analogWrite(IR_ANODE, pulse_ratio, { freq : IR_FREQ } );
            for (let i=0; i < 3; i++){
                header();
                code();
            }
            digitalPulse(IR_CATHODE, 1, 0);
            digitalRead(IR_ANODE);
        }
    
    //....
        function some_function(){
            //....
            console.log('shot');
            shot();
            //....
        }
    //....
    
    };
    

    1 Attachment

    • sony_IR.jpg
  • Tue 2021.09.14

    reply to post #15

    'Perhaps I just made a mistake somewhere.'

    Nicely written code block @lshk    Neat, concise and self descriptive.

    Nothing stands out.

    'but nothing came of it.'

    What is meant here? The camera just didn't respond and troubleshooting ceased as an O-Scope or Logic Analyzer wasn't available?



    The diagram output now makes more sense. That tid-bit would have assisted immensly initially. But it does appear doable.

    What is the visual output of the code block above, so that we may compare with what the Sony device is expecting?

About

Avatar for lshk @lshk started