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... | |
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.
| 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.
| Xmpin | Value of the pin that the user wants to use for Xm |
| Xppin | Value of the pin that the user wants to use for Xp |
| Ympin | Value of the pin that the user wants to use for Ym |
| Yppin | Value of the pin that the user wants to use for Yp |
| Length | Length of the touchscreen the user has |
| Width | Width of the touchscreen the user has |
| X0 | X distance from the center of the touchscreen to the origin |
| Y0 | Y distance from the center of the touchscreen to the origin |
| 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.
| None |
| 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.
| None |
| 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.
| None |
| 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.
| None |
| touchy.touchy.Length |
Length value.
Stores the value of the length of the screen that the user input
| touchy.touchy.Width |
Width value.
Stores the value of the width of the screen that the user input
| touchy.touchy.X0 |
Center X value.
Stores the value of the X center of the screen that the user input
| touchy.touchy.Xm |
Low X pin object.
Set the Pin object as an input to begin
| touchy.touchy.Xmpin |
Low X pin.
This pin is kept floating in order to read values from the high X
| touchy.touchy.Xp |
High X pin object.
Set the Pin object as an input to begin
| touchy.touchy.Xppin |
High X pin.
This pin is high to output a voltage that will go through the touchscreen
| touchy.touchy.Y0 |
Center Y value.
Stores the value of the Y center of the screen that the user input
| touchy.touchy.Ym |
Low Y pin object.
Set the Pin object as an input to begin
| touchy.touchy.Ympin |
Low Y pin.
This pin is kept floating in order to read values from the high Y
| touchy.touchy.Yp |
High Y pin object.
Set the Pin object as an input to begin
| touchy.touchy.Yppin |
High Y pin.
This pin is high to output a voltage that will go through the touchscreen