Hardware Reference
In-Depth Information
}
setTimeout ( getSliderStatus , 20 );
}
}
Direct the browser where to find your Bone. After the connection is made, run is
called.
Bring in the BoneScript library.
Select which analog port ( SLIDER ) and which GPIO pin ( BUTTON ) to use.
Call getSliderStatus() to get things started.
Read the analog-in and call onSliderRead when the value is available.
Here's an important step. If there is no error, set the value of sliderStatus to
the value read. x.value is the analog value read. Adding .toFixed(3) makes
it display only three digits. $('#sliderStatus') is our connection to the
HTML. The # specifies to look for the HTML with the matching ID. In our case,
$('sliderStatus') instructs us to look for the HTML elements with
id="sliderStatus" . In this example, it's <span
id="sliderStatus">-</span> . Adding the .html() (giving
$('#sliderStatus').html ) makes the statement refer to everything
between <span> and </span> , which initially is just - . The entire statement says
to change whatever is between the spans to the analog value that was read. And
the web page instantly changes that value.
Now, move on to reading the button.
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search