examples/readAndAnimate/sketch.js
function gotData() {
  var currentString = serial.readLine();  // read the incoming data
  trim(currentString);                    // trim off trailing whitespace
  if (!currentString) return;             // if the incoming string is empty, do no more
  console.log(currentString);
  if (!isNaN(currentString)) {  // make sure the string is a number (i.e. NOT Not a Number (NaN))
    textXpos = currentString;   // save the currentString to use for the text position in draw()
  }
}
function gotData() {
  var currentString = serial.readLine();  // read the incoming data
  trim(currentString);                    // trim off trailing whitespace
  if (!currentString) return;             // if the incoming string is empty, do no more
  console.log(currentString);
  if (!isNaN(currentString)) {  // make sure the string is a number (i.e. NOT Not a Number (NaN))
    textXpos = currentString;   // save the currentString to use for the text position in draw()
  }
}
function gotData ( ) { var currentString = serial . readLine ( ) ; // read the incoming data trim ( currentString ) ; // trim off trailing whitespace if ( ! currentString ) return ; // if the incoming string is empty, do no more console . log ( currentString ) ; if ( ! isNaN ( currentString ) ) { // make sure the string is a number (i.e. NOT Not a Number (NaN)) textXpos = currentString ; // save the currentString to use for the text position in draw() } }
Called when there is data available from the serial port
Called when there is data available from the serial port