2v03 (c) 2018 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate > >dmf() [ "LOW_MEMORY" ] =undefined >pm() { "free": 824, "usage": 1676, "total": 2500, "history": 728, "gc": 0, "gctime": 4.0283203125, "stackEndAddress": 536928592, "flash_start": 0, "flash_binary_end": 428148, "flash_code_start": 442368, "flash_length": 524288 } =undefined >rgc() [ ] { "free": 819, "usage": 1681, "total": 2500, "history": 730, "gc": 0, "gctime": 4.24194335937, "stackEndAddress": 536928592, "flash_start": 0, "flash_binary_end": 428148, "flash_code_start": 442368, "flash_length": 524288 } =undefined >dmf() [ ] =undefined >pm() { "free": 824, "usage": 1676, "total": 2500, "history": 732, "gc": 0, "gctime": 4.0283203125, "stackEndAddress": 536928592, "flash_start": 0, "flash_binary_end": 428148, "flash_code_start": 442368, "flash_length": 524288 } =undefined >dpu() Uncaught ReferenceError: "dpu" is not defined at line 1 col 1 dpu() ^ >dump() var LOG_FLAG_COUNTER = 1; var LOG_FLAG_SHOW_BLANK = 2; var LOG_FLAG_READ_PULSES = 8; Uncaught ReferenceError: "dpu" is not defined at line 1261 col 3 dpu(); ^ in function "cc" called from line 1275 col 4 cc(); TEST2 even though function dpu() is in fact there >pm() { "free": 854, "usage": 1646, "total": 2500, "history": 745, >dmf() [ ] =undefined > ===== repeatable 2v03 (c) 2018 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate > >dmf() [ "LOW_MEMORY" ] =undefined >pm() { "free": 824, "usage": 1676, "total": 2500, "history": 728, "gc": 0, "gctime": 3.99780273437, "stackEndAddress": 536928592, "flash_start": 0, "flash_binary_end": 428148, "flash_code_start": 442368, "flash_length": 524288 } =undefined >rgc() [ ] { "free": 819, "usage": 1681, "total": 2500, "history": 730, "gc": 0, "gctime": 4.24194335937, "stackEndAddress": 536928592, "flash_start": 0, "flash_binary_end": 428148, "flash_code_start": 442368, "flash_length": 524288 } =undefined >pm() { "free": 824, "usage": 1676, "total": 2500, "history": 732, "gc": 0, "gctime": 4.21142578125, "stackEndAddress": 536928592, "flash_start": 0, "flash_binary_end": 428148, "flash_code_start": 442368, "flash_length": 524288 } =undefined >dmf() [ ] =undefined >t1() STARTUP: update: 1000 freq: 4 gate: 500 calc time between rising edges: 0.25 pulseMarkFreq: 4 pulseWidthGate: 500 Expected pulse count: 2 argsStartup: [object Object] 1000 500 4 ARGSDEFAULT 5000 20 223 t1() ARGS1000 1000 500 4 t2() ARGS2000 2000 20 321 t3() ARGS1000F200 1000 20 200 t4() ARGS3000F100 3000 20 123 t5() ARGS4000F234 4000 20 234 =undefined >r() counter: 0 counterPulses: 0 Uncaught ReferenceError: "dpu" is not defined at line 1265 col 3 dpu(); ^ in function "cc" called from line 1279 col 4 cc(); ^ in function "r" called from line 1 col 3 r() ^ > ==== ESPRUINO WEB IDE > |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v03 (c) 2018 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate > >dmf() [ "LOW_MEMORY" ] =undefined >pm() { "free": 869, "usage": 1631, "total": 2500, "history": 728, "gc": 0, "gctime": 3.72314453125, "stackEndAddress": 536928592, "flash_start": 0, "flash_binary_end": 428148, "flash_code_start": 442368, "flash_length": 524288 } =undefined >process.memory =function () { [native code] } >pm() { "free": 869, "usage": 1631, "total": 2500, "history": 733, "gc": 0, "gctime": 3.72314453125, "stackEndAddress": 536928592, "flash_start": 0, "flash_binary_end": 428148, "flash_code_start": 442368, "flash_length": 524288 } =undefined >dmf() [ ] =undefined >t1() STARTUP: update: 1000 freq: 4 gate: 500 calc time between rising edges: 0.25 pulseMarkFreq: 4 pulseWidthGate: 500 Expected pulse count: 2 argsStartup: [object Object] 1000 500 4 ARGSDEFAULT 5000 20 223 t1() ARGS1000 1000 500 4 t2() ARGS2000 2000 20 321 t3() ARGS1000F200 1000 20 200 t4() ARGS3000F100 3000 20 123 t5() ARGS4000F234 4000 20 234 =undefined >r() counter: 0 counterPulses: 0 Uncaught ReferenceError: "dpu" is not defined at line 1261 col 3 dpu(); ^ in function "cc" called from line 1275 col 4 cc(); ^ in function "r" called from line 1 col 3 r() ^ >cc() counter: 0 counterPulses: 0 Uncaught ReferenceError: "dpu" is not defined at line 1261 col 3 dpu(); ^ in function "cc" called from line 1 col 4 cc() ^ >dump() var LOG_FLAG_COUNTER = 1; var LOG_FLAG_SHOW_BLANK = 2; var LOG_FLAG_READ_PULSES = 8; var LOG_FLAG_ISACTIVE_F = 16; var LOG_FLAG_ISACTIVE_T = 32; var LOG_FLAG_CALC_ONLY = 256; var logFlags = 0; function rfg() { logFlags = 0x00; df(); } function sfg() { logFlags = 0x00; //logFlags = LOG_FLAG_COUNTER | LOG_FLAG_SHOW_BLANK; logFlags = logFlags | LOG_FLAG_COUNTER; logFlags = logFlags | LOG_FLAG_SHOW_BLANK; //logFlags = logFlags ^ LOG_FLAG_READ_PULSES; // Enable IsActive flags logFlags = logFlags | LOG_FLAG_ISACTIVE_F; logFlags = logFlags | LOG_FLAG_ISACTIVE_T; logFlags = logFlags | LOG_FLAG_CALC_ONLY; } var logEnable = true; var logVerbose = true; function von() {logVerbose = true;} function vof() {logVerbose = false;} function eon() {logEnable = true;} function eof() {logEnable = false;} function lrp() {logFlags = logFlags ^ LOG_FLAG_READ_PULSES;} function lsb() {logFlags = logFlags ^ LOG_FLAG_SHOW_BLANK;} function lat() {logFlags = logFlags ^ LOG_FLAG_ISACTIVE_T;} function laf() {logFlags = logFlags ^ LOG_FLAG_ISACTIVE_F;} function lco() {logFlags = logFlags ^ LOG_FLAG_CALC_ONLY;} function lf() { console.log( " " ); console.log( " Toggle bits with the following function shortcuts" ); console.log( " LOG_FLAG_READ_PULSES " + " lrp()" ); console.log( " LOG_FLAG_SHOW_BLANK " + " lsb()" ); console.log( " " ); console.log( " LOG_FLAG_ISACTIVE_F " + " laf()" ); console.log( " LOG_FLAG_ISACTIVE_T " + " lat()" ); console.log( " " ); console.log( " LOG_FLAG_CALC_ONLY " + " lco()" ); } function df() { console.log( ( ( logFlags & LOG_FLAG_COUNTER ) ? 1 : 0 ) + " LOG_FLAG_COUNTER" ); console.log( ( ( logFlags & LOG_FLAG_SHOW_BLANK ) ? 1 : 0 ) + " LOG_FLAG_SHOW_BLANK" ); console.log( ( ( logFlags & LOG_FLAG_READ_PULSES ) ? 1 : 0 ) + " LOG_FLAG_READ_PULSES" ); console.log( ( ( logFlags & LOG_FLAG_ISACTIVE_F ) ? 1 : 0 ) + " LOG_FLAG_ISACTIVE_F" ); console.log( ( ( logFlags & LOG_FLAG_ISACTIVE_T ) ? 1 : 0 ) + " LOG_FLAG_ISACTIVE_T" ); console.log( ( ( logFlags & LOG_FLAG_CALC_ONLY ) ? 1 : 0 ) + " LOG_FLAG_CALC_ONLY" ); // Display related bit toggle function names lf(); console.log( " " ); console.log( " " ); console.log( " " ); console.log( " Current value of calcFreq3: " + calcFreq3 ); console.log( " L166 counterPulses: " + counterPulses + " $$$$$$$$$ &&&&&&&&" ); // Step 3 // Use separate pin for gate DigitalPulse out for duration timing - like CS // D14 Output var pinPulseTiming = D14; pinMode( pinPulseTiming, 'output' ); var modePinD14 = getPinMode( pinPulseTiming ); // Used to show WebIDE console is updating when screen filled var counter = 0; var counterrunning = 0; // Duration in msec of gate pulse var pulseWidthGate = 5; var pulseWidthGate = 10; var pulseWidthGate = 20; //var pulseWidthGate = 500; //var pulseWidthGate = 50; // Set Gate pulse width function sg( g ) { pulseWidthGate = g; } // Digital Pulse -> CS function dp() { // 5msec goal digitalPulse( pinPulseTiming, 1, pulseWidthGate ); if( ( logEnable || logVerbose ) && ( logFlags & LOG_FLAG_COUNTER ) ) { // Display startup args da(); console.log( counter + " Pulse L151" ); } else { let objnull = ( ( counter % 10 ) === 0 ) ? console.log( "counter running " + counterrunning++ ) : ( counter = counter ); } counter++; // Option Base 0 - range 0 - 9 if( counter >= 10 ) counter = 0; } function dpoff() { digitalPulse( pinPulseTiming, 0, pulseWidthGate ); } function dpu() { console.log( " pinPulseTiming: " + pinPulseTiming ); console.log( " pulseWidthGate: " + pulseWidthGate ); } // Step 4 Wire external button for user interrupt // Step 7 // External button press sends one pulse function swbp() { setWatch( function(e) { console.log( "Button pressed - Sending pulse" ); dp(); }, D15, { repeat: true, edge: 'rising', debounce: 20 } ); } // Fri 2020.03.27 // Possible error D15 for onboard????? // Set Watch Button Onboard - msg when released function swb() { setWatch( function(e) { console.log( "Button pressed" ); }, D15, { repeat: true, edge: 'rising', debounce: 20 } ); } } var pinWaveform = D17; var pulseMarkFreq = 4; function stwv() {analogWrite( pinWaveform, 0.2, { freq : pulseMarkFreq } );} function stwoff() {analogWrite( pinWaveform, 0, { freq : pulseMarkFreq } );} var isActive = false; var pinInputWaveform = D18; var counterPulses = 0; var counterPulsesSave = 0; var timeStampLast3 = 0; var timeStampPulseEnd3 = 0; var timeStampPulseDur3 = 0; var calcFreq3 = 0; var temp3 = 0; var calcInterm = 0; var calcIntermSav = 0; var pw = 0; function swr() { setWatch( function(e) { // console.log( " Read inside swr() isActive: " + isActive ); //Debug // if( false ) if( !isActive ) { counterPulses++; //SAVE console.log( " L437 Read inside swr() counterPulses: " + counterPulses ); if( counterPulses === 5 ) console.log( " L411 Read inside swr() counterPulses: " + counterPulses + " &&&&&&&&&&&&& &&&&&&&&" ); } // Hi CS pulse gate // if( isActive ) { if( isActive ) { if( counterPulses == 0 ) { // timeStampLast3 = 0; } counterPulses++; if( counterPulses === 3 ) console.log( " L437 Read inside swr() counterPulses: " + counterPulses + " &&&&&&&&&&&&&&&&&&&&&&&&&&&" ); temp3 = timeStampLast3; timeStampLast3 = e.lastTime; timeStampPulseDur3 = timeStampLast3 - temp3; calcInterm = 1 / timeStampPulseDur3; calcIntermSav = calcInterm; if( false ) if( counterPulses == 2 ) { console.log( " ==2 ************* L398 calcIntermSav swr() L333 :" + calcIntermSav ); } //if( false ) if( ( logEnable || logVerbose ) && ( logFlags & LOG_FLAG_READ_PULSES ) ) { console.log( " L398 swr() L332 :" + counterPulses + " timeStampLast3: " + timeStampLast3 + " temp3: " + temp3 + " timeStampPulseDur3: " + timeStampPulseDur3 ); console.log( " L398 calcInterm swr() L333 :" + calcInterm ); } } }, pinInputWaveform, { repeat: true, edge: 'rising' } ); } var pinSetWatchTiming = D16; var first = 0; var last = 0; var diff = 0; var t = 0; var elaspsed = 0; var str = { }; var timeStampLast = 0; var timeStampPulseEnd = 0; var timeStampPulseDur = 0; var calcFreq = 0; var pinStateSync = false; function sync() { pinStateSync = digitalRead( pinPulseTiming ); isActive = pinStateSync ? false : true; } function swp() { setWatch( function(e) { // Save the current state of the pin on rising should be 1 isActive = e.state; if( isActive ) { stwv(); // Create a 20% duty cycle pulse train // analogWrite( pinWaveform, 0.2, { freq : pulseMarkFreq } ); } if( !isActive ) { counterPulsesSave = counterPulses; // Shut off the pulse stream stwoff(); } if( logFlags & LOG_FLAG_CALC_ONLY ) { console.log( " L553 swp() 3 calcFreq3: " + calcFreq3 + " " + counterPulses ); } if( logVerbose ) { console.log( " L488 Pulse inside swp()" ); } elapsed = getTime()-t; if( logVerbose ) { console.log("elapsed " + elapsed ); } first = last; last = elapsed; diff = last - first; if( logVerbose ) { console.log( " L501 diff " + diff ); } str = elapsed * 1000; //****down*********** console.log( " L496 swp() isActive=" + e.state ); if( logVerbose ) { console.log( " L497 *********down*****************" ); } if( isActive ) { if( ( logEnable || logVerbose ) && ( logFlags & LOG_FLAG_ISACTIVE_T ) ) { console.log( " L477 after stwv() pulse train on" ); } } if( !isActive ) { calcFreq = ( 1 / ( pulseWidthGate / counterPulses ) ) * 1000; if( ( logEnable || logVerbose ) && ( logFlags & LOG_FLAG_ISACTIVE_T ) ) { console.log( " pulseWidthGate: " + pulseWidthGate + " counterPulses: " + counterPulses + " calc: " + ( pulseWidthGate / counterPulses ) ); console.log( " 1 /: " + ( 1 / ( pulseWidthGate / counterPulses ) ) + " *1000: " + ( 1 / ( pulseWidthGate / counterPulses ) ) * 1000 + " calcFreq: " + calcFreq ); } timeStampPulseEnd = e.lastTime; timeStampPulseDur = timeStampPulseEnd - timeStampLast; counterPulses = 0; //stwoff(); if( ( logEnable || logVerbose ) && ( logFlags & LOG_FLAG_ISACTIVE_T ) ) { console.log( "swp() timeStampPulseDur: " + timeStampPulseDur ); console.log( "swp() 1 / timeStampPulseDur: " + ( 1 / timeStampPulseDur ) ); console.log( "swp() calcFreq: " + calcFreq ); } var pw = timeStampPulseDur3 * .2; if( ( logEnable || logVerbose ) && ( logFlags & LOG_FLAG_ISACTIVE_T ) ) { console.log( " "); console.log( " timeStampPulseDur3 * .2: " + pw + " timeStampLast3: " + timeStampLast3 ); console.log( " timeStampPulseEnd3: " + timeStampPulseEnd3 + " timeStampPulseDur3: " + timeStampPulseDur3 ); } calcFreq3 = ( 1 / timeStampPulseDur3 ); if( ( logEnable || logVerbose ) && ( logFlags & LOG_FLAG_ISACTIVE_T ) ) { console.log( "swp() 3 timeStampPulseDur3: " + timeStampPulseDur3 ); console.log( "swp() 3 calcFreq3: " + calcFreq3 ); } if( logFlags & LOG_FLAG_CALC_ONLY ) { console.log( "swp() 3 calcFreq3: " + calcFreq3 ); } } // if( !isActive ) if( !isActive ) { // Shut off the pulse stream // stwoff(); if( ( logEnable || logVerbose ) && ( logFlags & LOG_FLAG_ISACTIVE_F ) ) { console.log( " L557 after stwoff() pulse train off" ); } if( logVerbose ) { console.log( " L599 ********falling******************" ); console.log( " L599 ********falling******************" ); } } if( logFlags & LOG_FLAG_CALC_ONLY ) { console.log( " L665 swp() 3 calcFreq3: " + calcFreq3 + " " + counterPulsesSave ); console.log( "swp() 3 calcFreq3: " + calcFreq3 ); } console.log( " L559 ********up*****************" ); //**up************* }, pinSetWatchTiming, { repeat: true, edge: 'both' } ); } function ti() { console.log(global["\xFF"].timers); //nice, less info console.log( " " ); console.log( "Starting trace" ); console.log( " " ); trace(global["\xFF"].timers); } function pm() {console.log( process.memory() );} function pmf() {console.log( process.memory().free );} function gmf() {return ( process.memory().free );} function e() {console.log( process.env );} function d() {dump();} function dmf() {console.log( E.getErrorFlags() );} function gmflm() {return ( E.getErrorFlags().LOW_MEMORY );} function h() {help();} function help() { console.log( " " ); console.log( " " ); console.log( "Tutorial PPI - Programmable Peripheral Interconnect" ); console.log( " for the MDBT42Q Breakout board" ); console.log( " " ); console.log( " " ); console.log( "Single letter command line helper functions" ); console.log( " " ); console.log( " " ); console.log( " h() help " ); console.log( " " ); // console.log( " i() onInit" ); // console.log( " onInit() initialize" ); console.log( " hr() help run commands" ); console.log( " " ); console.log( " pm() process.memory()" ); console.log( " e() process.env" ); console.log( " d() dump()" ); console.log( " " ); console.log( " ti() display timers running" ); console.log( " " ); console.log( " " ); console.log( " " ); console.log( " " ); console.log( " von() Verbose logging on" ); console.log( " vof() Turn off verbose logging" ); console.log( " df() Display logging flags" ); console.log( " ci() clearInterval() using current ID" ); console.log( " cia() all clearInterval()" ); console.log( " ct() clearTimeout()" ); console.log( " cw() clearWatch()" ); console.log( " " ); console.log( " si() setInterval()" ); console.log( " st() start()" ); console.log( " " ); console.log( " " ); console.log( " dp() Digital Pulse()" ); console.log( " dpoff() Turn Off Digital Pulse()" ); console.log( " sync() Sync flag with pin state" ); // Sync flag with pin state console.log( " " ); console.log( " " ); console.log( " swbe() Set Watch Button External" ); console.log( " swb() Set Watch Button Onboard" ); console.log( " swp() Set Watch Pulses" ); console.log( " swr() Set Watch Read" ); console.log( " " ); // console.log( " " ); console.log( " stwv() Start pulse train waveform" ); console.log( " stwoff() Stop pulse train output" ); console.log( " " ); console.log( " " ); //dup above console.log( " swp() Set Watch using PPI" ); console.log( " dc() Display count" ); console.log( " stc() Stop PPI counter" ); console.log( " " ); console.log( " " ); console.log( " " ); } function hr() {helprun();} function helprun() { console.log( " " ); console.log( " " ); console.log( " Common run start commands used during setup" ); console.log( " " ); console.log( " " ); console.log( " h() help" ); console.log( " " ); console.log( " " ); console.log( " " ); console.log( " " ); console.log( " t4() Test dataset 4" ); console.log( " da() Display Args" ); console.log( " df() Display Flags" ); console.log( " rfg() Reset Flags" ); console.log( " " ); console.log( " " ); console.log( " rsc() Run Start Commands" ); console.log( " sf( f ) f SetFrequency( f ) Hz 1 - 3000" ); console.log( " su( u ) u SetUpdate( u ) msec to CS pulse" ); console.log( " sg( g ) g SetGate( g ) msec pulse width" ); console.log( " " ); console.log( " st() Start" ); console.log( " " ); console.log( " " ); } var intervalID = { }; var timeoutID = { }; function ci() {clearInterval( intervalID );} function cia() {clearInterval();} function ct() {clearTimeout( timeoutID );} function cw() {clearWatch();} function si() {sio( argsStartup );} var update = 1000; function sio(options) { if( typeof options !== "object" ) options = {}; options.update = options.update || ARGSUPDATE; options.freq = options.freq || ARGSFREQ; // Default update interval // var update = options.update; update = options.update; pulseMarkFreq = options.freq; if( typeof argsStartup.update !== "undefined" ) { // update = argsStartup.update; argsStartup.update = options.update; } if( typeof argsStartup.freq !== "undefined" ) { // pulseMarkFreq = argsStartup.freq; argsStartup.freq = options.freq; } // Display Args da(); df(); try { var f = {}; var flm = {}; var fm = {}; intervalID = setInterval( function() { fm = gmf(); console.log( " Free mem: " + fm ); f = E.getErrorFlags(); // console.log( " flags LOW_MEMORY: " + f ); flm = E.getErrorFlags().LOW_MEMORY; // console.log( " LOW_MEMORY: " + flm ); //Uncaught // flags LOW_MEMORY: // LOW_MEMORY: undefined if( flm !== undefined ) throw( "Err L1126 " + f ); // Digital Pulse dp(); }, update ); } catch(e) { console.log("L[1140]interval() catch() ***********" + e.toString() ); throw e.toString(); } } var argsStartup = { "gate": 500, "freq": 4, "update": 1000 }; var ARGSUPDATE = 5000; var ARGSFREQ = 223; var ARGSGATE = 20; var ARGSDEFAULT = { "update": 5000, "gate": 20, "freq": 223 }; var ARGS2000 = { "update": 2000, "gate": 20, "freq": 321 }; var ARGS1000 = { "update": 1000, "gate": 500, "freq": 4 }; var ARGS1000F200 = { "update": 1000, "gate": 20, "freq": 200 }; var ARGS3000F100 = { "update": 3000, "gate": 20, "freq": 123 }; var ARGS4000F234 = { "update": 4000, "gate": 20, "freq": 234 }; function da() { console.log( " STARTUP: update: " + argsStartup.update ); console.log( " freq: " + argsStartup.freq ); console.log( " gate: " + argsStartup.gate ); console.log( " " ); console.log( " calc time between rising edges: " + ( 1 / argsStartup.freq ) ); console.log( " " ); console.log( " " ); console.log( " pulseMarkFreq: " + pulseMarkFreq ); console.log( " " ); console.log( " " ); console.log( " pulseWidthGate: " + pulseWidthGate ); console.log( " " ); console.log( " " ); console.log( " Expected pulse count: " + ( (pulseWidthGate / 1000) / ( 1 / argsStartup.freq ) ) ); console.log( " " ); console.log( " " ); console.log( " argsStartup: " + argsStartup + " " + argsStartup.update + " " + argsStartup.gate + " " + argsStartup.freq ); console.log( " " ); console.log( " " ); console.log( " ARGSDEFAULT " + ARGSDEFAULT.update + " " + ARGSDEFAULT.gate + " " + ARGSDEFAULT.freq ); // console.log( " ARGS3000F100 " + ARGS3000F100 ); //object console.log( " " ); console.log( " t1() ARGS1000 " + ARGS1000.update + " " + ARGS1000.gate + " " + ARGS1000.freq ); console.log( " " ); console.log( " t2() ARGS2000 " + ARGS2000.update + " " + ARGS2000.gate + " " + ARGS2000.freq ); console.log( " " ); console.log( " t3() ARGS1000F200 " + ARGS1000F200.update + " " + ARGS1000F200.gate + " " + ARGS1000F200.freq ); console.log( " " ); console.log( " t4() ARGS3000F100 " + ARGS3000F100.update + " " + ARGS3000F100.gate + " " + ARGS3000F100.freq ); console.log( " " ); console.log( " t5() ARGS4000F234 " + ARGS4000F234.update + " " + ARGS4000F234.gate + " " + ARGS4000F234.freq ); console.log( " " ); } function sf(f) { argsStartup.freq = f; pulseMarkFreq = f; } function su(u) { argsStartup.update = u; update = u; } function sg(g) { argsStartup.gate = g; pulseWidthGate = g; } function sgt(a) { sg( a.gate ); sf( a.freq ); su( a.update ); // sg( a ); // sf( a ); // su( a ); da(); } function t1() {sgt( ARGS1000 );} function t2() {sgt( ARGS2000 );} function t3() {sgt( ARGS1000F200 );} function t4() {sgt( ARGS3000F100 );} function t5() {sgt( ARGS4000F234 );} function st() { try { // Reset counter - display only counter = 0; // Set default flags sfg(); // Add setWatch()'s // Clear all previous cw(); // Set Watch Button External swbe(); // Set Watch Button Onboard swb(); // setWatch Pulses swp(); // setWatch Read swr(); // Sync flag with pin state pinStateSync = digitalRead( pinPulseTiming ); isActive = pinStateSync ? false : true; //var pinPulseTiming = D14; var pinSetWatchTiming = D16; // Start the pulse train waveform 2000Hz stwv(); //in swp stwv(); timeoutID = setTimeout( function() { // Turn off verbose logging //von(); // vof(); si(); }, 500 ); } catch(e) { console.log("L[1290]interval() catch() ***********" + e.toString() ); throw e.toString(); } } function rsc() { da(); // Start st(); // Gate sg( 50 ); // Turn Off T lat(); // Turn Off F laf(); vof(); } var AUTO_START_ON = false; function r3() { lco(); t5(); rsc(); } function cc() { counterPulses = 0; counter = 0; dc(); dpu(); } function dc() { console.log( " counter: " + counter ); console.log( " counterPulses: " + counterPulses ); } function r() { cc(); //counterPulses = 0; //counter = 0; // Clear setWatch cw(); // Reset Flags rfg(); //These toggle // Turn Off T // lat(); // Turn off F // laf(); // Verbose off // vof(); // Calc only lco(); //t4(); // Gate //sg( 50 ); // Display Args da(); // Start // st(); // Set Watch for gate // Set Watch Button External swbe(); // Set Watch Button Onboard swb(); // setWatch Pulses swp(); // setWatch Read swr(); // External button press sends one pulse swbp(); // Sync flag with pin state dp(); sync(); } function rm(options) { try { update = 1000; var f; var flm; intervalID = setInterval( function() { f = E.getErrorFlags(); // console.log( " flags LOW_MEMORY: " + f ); flm = E.getErrorFlags().LOW_MEMORY; // console.log( " LOW_MEMORY: " + flm ); if( flm !== undefined ) throw( "Err L1576 " + f ); // Digital Pulse dp(); }, update ); } catch(e) { console.log("L[1530]interval() catch() ***********" + e.toString() ); throw e.toString(); } } var pulseWidthGate = 500; var counter = 0; pinMode(D17, "output"); =undefined >dmf() [ ] =undefined >pm() { "free": 854, "usage": 1646, "total": 2500, "history": 741, "gc": 0, "gctime": 3.84521484375, "stackEndAddress": 536928592, "flash_start": 0, "flash_binary_end": 428148, "flash_code_start": 442368, "flash_length": 524288 } =undefined >da() STARTUP: update: 1000 freq: 4 gate: 500 calc time between rising edges: 0.25 pulseMarkFreq: 4 pulseWidthGate: 500 Expected pulse count: 2 argsStartup: [object Object] 1000 500 4 ARGSDEFAULT 5000 20 223 t1() ARGS1000 1000 500 4 t2() ARGS2000 2000 20 321 t3() ARGS1000F200 1000 20 200 t4() ARGS3000F100 3000 20 123 t5() ARGS4000F234 4000 20 234 =undefined >r() counter: 0 counterPulses: 0 Uncaught ReferenceError: "dpu" is not defined at line 1261 col 3 dpu(); ^ in function "cc" called from line 1275 col 4 cc(); ^ in function "r" called from line 1 col 3 r() ^ >dpu() Uncaught ReferenceError: "dpu" is not defined at line 1 col 1 dpu() ^ > []