OutputByte Method

void OutputByte(int port, int val)

Summary

This method writes a new output value to one of the digital I/O ports on the device. When the port is configured as an output port (using the SetDirection Method), each bit of the output value determines the voltage (0 or 5V) of the corresponding bit of the port. When the port is configured as an input port, any 1-bits in the output value enables a weak pullup for that bit of the port.

Parameters

  • port - The port number to write to (0-5).

  • value - The new value for the port. This may be 0-255 for ports 0-3 and 0-1 for the single-bit ports 4 and 5.

Return Value

This method does not return a value.

Remarks

Port 3 shares its pins with the analog channels. When the ADC is enabled, all pins of port 3 are forced into input mode and the output value is set to zero. Port 3's output value cannot be modified while the ADC is enabled.

Example
Eth32 dev = new Eth32();

try
{
	// .... Your code that establishes a connection here
	
	// Set port 0 pins to be outputs
	dev.SetDirection(0, 255);
	
	// Write a new value for port 0
	dev.OutputByte(0, 85);
}
catch (Eth32Exception e)
{
	// Handle Eth32 errors here
}
       
See Also

InputByte Method, OutputBit Method, Readback Method, SetDirection Method