405 Documentation  9.0
touchy.touchy Class Reference

Tells where it is being touched. More...

Public Member Functions

def __init__ (self, Xmpin, Xppin, Ympin, Yppin, Length, Width, X0, Y0)
 Initialization Function. More...
 
def Xcoord (self)
 X-coordinate method. More...
 
def Ycoord (self)
 Y-coordinate method. More...
 
def Zbool (self)
 Z-coordinate method. More...
 
def allread (self)
 Read all coordinates. More...
 

Public Attributes

 Xmpin
 Low X pin. More...
 
 Xppin
 High X pin. More...
 
 Ympin
 Low Y pin. More...
 
 Yppin
 High Y pin. More...
 
 Xm
 Low X pin object. More...
 
 Xp
 High X pin object. More...
 
 Ym
 Low Y pin object. More...
 
 Yp
 High Y pin object. More...
 
 Length
 Length value. More...
 
 Width
 Width value. More...
 
 X0
 Center X value. More...
 
 Y0
 Center Y value. More...
 

Detailed Description

Tells where it is being touched.

Input 4 pin values, the length of the touchscreen, the width of the touchscreen, the distance from x = 0 edge to the center, and the distance form the y = 0 edge to the center. Once given, the class will return results from whichever method activated.

Author
Jacob Everest
Date
Mar. 1, 2021

Constructor & Destructor Documentation

◆ __init__()

def touchy.touchy.__init__ (   self,
  Xmpin,
  Xppin,
  Ympin,
  Yppin,
  Length,
  Width,
  X0,
  Y0 
)

Initialization Function.

Stores the parameters input by the user when creating the class object so that they may be used later by other functions.

Parameters
XmpinValue of the pin that the user wants to use for Xm
XppinValue of the pin that the user wants to use for Xp
YmpinValue of the pin that the user wants to use for Ym
YppinValue of the pin that the user wants to use for Yp
LengthLength of the touchscreen the user has
WidthWidth of the touchscreen the user has
X0X distance from the center of the touchscreen to the origin
Y0Y distance from the center of the touchscreen to the origin
Author
Jacob Everest
Date
Mar. 1, 2021

Member Function Documentation

◆ allread()

def touchy.touchy.allread (   self)

Read all coordinates.

Runs the x coordinate, y coordinate, and z boolean methods. It then returns those values in a tuple. It also times how long it takes itself to do that in microseconds.

Parameters
None
Author
Jacob Everest
Date
Mar. 1, 2021

◆ Xcoord()

def touchy.touchy.Xcoord (   self)

X-coordinate method.

Reads the value of the Ym pin to determine the voltage being sent to it by contact with the Xp Xm line. This voltage is proportional to the distance along the x axis where the screen is being touched. That is converted from an analog ot a digital value between 0 and 4095. The value is then divided by 4095 and multiplied by the length of the screen to get the actual x placement of where the screen is being touched. X0 is then subtracted from that value to put the origin at the center of the screen lengthwise, with the negative being on the left and the positive being on the right.

Parameters
None
Author
Jacob Everest
Date
Mar. 1, 2021

◆ Ycoord()

def touchy.touchy.Ycoord (   self)

Y-coordinate method.

Reads the value of the Xm pin to determine the voltage being sent to it by contact with the Yp Ym line. This voltage is proportional to the distance along the y axis where the screen is being touched. That is converted from an analog ot a digital value between 0 and 4095. The value is then divided by 4095 and multiplied by the width of the screen to get the actual x placement of where the screen is being touched. Y0 is then subtracted from that value to put the origin at the center of the screen widthwise, with the negative being on the bottom and the positive being on the top.

Parameters
None
Author
Jacob Everest
Date
Mar. 1, 2021

◆ Zbool()

def touchy.touchy.Zbool (   self)

Z-coordinate method.

Reads the value of the Ym pin to determine the voltage being sent to it by contact with the Yp Xm line. When the screen is being touched, Ym will receive a lower amount of voltage as some of the voltage will go to Xm which is set to low. When the value being read by Ym decreases, Z boolean pin will be set to say that contact has been made.

Parameters
None
Author
Jacob Everest
Date
Mar. 1, 2021

Member Data Documentation

◆ Length

touchy.touchy.Length

Length value.

Stores the value of the length of the screen that the user input

◆ Width

touchy.touchy.Width

Width value.

Stores the value of the width of the screen that the user input

◆ X0

touchy.touchy.X0

Center X value.

Stores the value of the X center of the screen that the user input

◆ Xm

touchy.touchy.Xm

Low X pin object.

Set the Pin object as an input to begin

◆ Xmpin

touchy.touchy.Xmpin

Low X pin.

This pin is kept floating in order to read values from the high X

◆ Xp

touchy.touchy.Xp

High X pin object.

Set the Pin object as an input to begin

◆ Xppin

touchy.touchy.Xppin

High X pin.

This pin is high to output a voltage that will go through the touchscreen

◆ Y0

touchy.touchy.Y0

Center Y value.

Stores the value of the Y center of the screen that the user input

◆ Ym

touchy.touchy.Ym

Low Y pin object.

Set the Pin object as an input to begin

◆ Ympin

touchy.touchy.Ympin

Low Y pin.

This pin is kept floating in order to read values from the high Y

◆ Yp

touchy.touchy.Yp

High Y pin object.

Set the Pin object as an input to begin

◆ Yppin

touchy.touchy.Yppin

High Y pin.

This pin is high to output a voltage that will go through the touchscreen


The documentation for this class was generated from the following file: