out( pinname, value )

Set output pin value

Use: out( pinname, value )
Description: Sets the output pin to value.
Note: the pin should be configured as an output using the pindir( ) command
Parameters: pinname Name of a pinname, This should be in the form Px_y. Where x is the port number, which can be 1 or 2, and y is the bit number which is between 0 and 7. (e.g. P2_3)
value The digital value to set the output pin. If the value is set to 0 then the output voltage will be 0v, if the value is set to 1 then the voltage will be the supply voltage.
Returns: None
Related: inp( ), pindir( )


Example:

pindir(P1_0, OUT)              # Set port P1_0 as an output (this is the Launchpad red led)
while 1:                       # do forever
   out(P1_0, 0)                # set the output pin P1_0 (red led) to a 0 (off)
   wait(500)                   # wait for 500ms  (half a second)
   out(P1_0, 1)                # set the output pin P1_0 (red led) to a 1 (on)
   wait(500)

When the output value is 0 the voltage at the output pin will be 0v. When it the output value is a 1 the output voltage will be equal to the supply voltage of the microcontroller.