MATLAB

Frame2TTL Object

Description

The Frame2TTL object allows you to configure the Frame2TTL device. 

After adding /Frame2TTL/Matlab/ to the MATLAB path, create a Frame2TTL object with the following syntax:

F = Frame2TTL('COM3');

Where COM3 is the Frame2TTL device's serial port.

The Frame2TTL device is controlled in 2 ways: 
  • Setting the Frame2TTL object's fields
  • Calling the Frame2TTL object's functions
Object Fields

  • Port 
    • ArCOM Serial port object
  • LightThreshold(us; default = 20)
    • Threshold for detection of the "light" state (output channel -> high). 
    • Can range from 10us to 1,000us
    • Smaller numbers = more light
  • DarkThreshold(us; default = 80)
    • Threshold for detection of the "dark" state  (output channel -> low). . 
    • Can range from 10us to 1,000us
    • Larger numbers = less light

Object Functions

  • readSensorValue()
    • Returns the current value of the optical sensor (in microseconds) 
  • stream()
    • Streams the current value of the optical sensor to a plot
    • Displays the current light and dark thresholds as light and dark horizontal lines
    • Close the plot figure to end streaming
    • The stream() function is used to gain intuition for thresholds.
      • While streaming, try changing the screen pixels under the sensor
      • Do not set thresholds during streaming.
Cleanup

  • Clear the Frame2TTL object with clear:
    F = Frame2TTL('COM3');
    ... % Use the Frame2TTL object
    clear F
  • Clearing the object releases the serial port, so other applications can access it.
  • If a Frame2TTL object is created inside a MATLAB function, the object is cleared automatically when the function returns.
Comments