0.6.5 • Published 10 years ago
arscripter v0.6.5
arscripter
A web-based approach to rapid Arduino prototyping. Program your Arduino board straight from the browser using JavaScript and GUI controls.
Requirements
Installation
npm install -g arscripter
Usage
- Connect Arduino via USB
- Execute
arscripter - Navigate to
http://localhost:8080in web browser
- Toggle the mode and/or value of a pin by clicking on the appropriate label
- PWM values can be set via the adjacent slider
- Analog values can be viewed in the adjacent graph
API
loop(ms, handler())Execute thehandlerfunction everymsmillisecondsdisplay(msg)Printmsgto the output pane
getPinValue(pin)Returns the current value of the givenpin
setPinValue(pin, value)Write avalueto a givenpin
toggleDigitalValue(pin)Write the opposite of the current value of a givenpin
getPinMode(pin)Returns the current mode of the givenpin
setPinMode(pin, mode)Set the mode of a givenpin, one of the possible pin modes (see below)
Pin Modes
0: Input1: Output2: Analog3: PWM
Basic Script
var pin = 13;
setPinMode(pin,1);
loop(1000, function() {
toggleDigitalValue(pin);
setTimeout(function() {
display('Pin ' + pin + ' value: ' + getPinValue(pin) + '\n');
}, 10);
});Notes
- The first analog pin is reached at the number following the last digital pin (e.g. the last digital pin on the Uno is pin 13, so A0 is pin 14).