Fork me on GitHub
beagleboard.org

BoneScript

You might be able to see a newer version of this on beagleboard.org/support/bonescript/digitalWrite

digitalWrite(pin, value, [callback])

Write a HIGH or LOW to a digital I/O pin.

NOTE: The 4 USRx LEDs are all able to operate as digital output pins, giving you an always-available output to test your software.

Arguments

  • pin: the BeagleBone pin identifier
  • value: the logic level to set the pin
  • callback: called upon completion

Return value

callback(x)

  • x.err: error status message

Example

var b = require('bonescript');
b.pinMode('USR0', b.OUTPUT);
b.digitalWrite('USR0', b.HIGH);

Build and execute instructions

  • The USR0 LED is built in, so no circuit assembly is required.
  • Look for it to go high when you run the example code.
  • Alter the code to set it low and run it again.

See also

Topics

Related functions

Examples