Issue with 2 touch area of UOLED 4D system
JChris
Posts: 58
I use UOLED 4D system that is the 32PTU.
I am trying to create a menu. When I create only one touch area, it works but when I create two touch areas, it doesn't work.
The program runs but there are two touch areas that don't work fine
If anyone has a hint, I would appreciate
My program is the following:
[Code]
{
************************************************************************************************************
* *
* AUTO-RECOVER NOTICE: This file was automatically recovered from an earlier Propeller Tool session. *
* *
* ORIGINAL FOLDER: \parallax\ *
* TIME AUTO-SAVED: over 1 day ago (14/08/2014 00:21:48) *
* *
* OPTIONS: 1) RESTORE THIS FILE by deleting these comments and selecting File -> Save. *
* The existing file in the original folder will be replaced by this one. *
* *
* -- OR -- *
* *
* 2) IGNORE THIS FILE by closing it without saving. *
* This file will be discarded and the original will be left intact. *
* *
************************************************************************************************************
.}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5000000
rxpin = 3
txpin = 4
reset = 5
OLEDBaud = 115200
obj
LED : "uLCD(SK)-32PTU_v2.0"
var 'Used ONLY for DEMO
long Random,X[4],Y[4],Angle[4],OldX[4],OldY[4],C[8], stack1[50], stack2[50],Touch1, OldTouc1,TouchCount1,Flag1,i
word X1,X2,X3,Y1,Y2,Y3
PUB main
LED.start(rxpin, txpin, reset, OLEDBaud) ''Starts uOLED display
LED.touch_Set(0)
RentrerEnContact
PUB RentrerEnContact
LED.touch_DetectRegion(8,18,160,94)
LED.gfx_Rectangle(8,18,160,53,LED.RGB(255,255,0))
LED.gfx_Button(1,10,20,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("Rentrer en contact"))
' LED.touch_DetectRegion(8,58,151,94)
' LED.gfx_Rectangle(8,58,151,94,LED.RGB(255,255,0))
' LED.gfx_Button(1,10,60,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("Trouver personne"))
LED.txt_BGColor(LED.RGB(0,0,0)) ''Set FG/BG color text for PRESSED RELEASED
' txt_FGColor(color)
LED.txt_FGColor(LED.RGB(64,255,64))
i := 0
repeat
Touch1 := LED.touch_Get(0) ''<-Touch Detect 0-Screen STATUS
X1 := LED.touch_Get(1) ''<-Touch Detect 1-X coordinate
Y1 := LED.touch_Get(2) ''<-Touch Detect 2-Y coordinate
if (Touch1 == 1)
if ((X1>=8 AND X1<= 160) AND (Y1>=18 AND Y1<=53 ))
if Touch1 <> OldTouc1
LED.ClearScreen
Case Touch1
0 : LED.txt_MoveCursor(11,1)
'LED._putStr(string("NO TOUCH",10)) '' Not used in DEMO
1 : LED.txt_MoveCursor(11,1)
coucou
'telephone
2 : LED.txt_MoveCursor(11,1) '' to trap ONLY the window of interest
if Flag1 == 1
Flag1 := 0
LED._putStr(string("RELEASED",10))
TouchCount1 := 50 '' Set Extinguish after release timeout
' 3 : LED.txt_MoveCursor(11,1)
' LED._putStr(string("MOVING ",10)) '' Not used in DEMO
' OldTouch1 := Touch1
if TouchCount1>0 '' Extinguish after release
TouchCount1--
if TouchCount1 == 0
LED.txt_MoveCursor(11,1)
LED._putStr(string(" ",10))
PUB coucou | Touch2, OldTouch2, Flag2, TouchCount2
LED._putStr(string("Dis bijour a rorodolf",10))
' LED.touch_Set(0)
LED.touch_DetectRegion(8,18,160,53)
LED.gfx_Rectangle(8,18,160,53,LED.RGB(255,255,0))
LED.gfx_Button(1,10,20,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("coucou"))
repeat
Touch1 := LED.touch_Get(0) ''<-Touch Detect 0-Screen STATUS
X1 := LED.touch_Get(1) ''<-Touch Detect 1-X coordinate
Y1 := LED.touch_Get(2) ''<-Touch Detect 2-Y coordinate
if (Touch1 == 1)
if ((X1>=8 AND X1<= 160) AND (Y1>=18 AND Y1<=53 ))
if Touch1 <> OldTouc1
LED.ClearScreen
Case Touch1
0 : LED.txt_MoveCursor(11,1)
'LED._putStr(string("NO TOUCH",10)) '' Not used in DEMO
1 : LED.txt_MoveCursor(11,1)
LED._putStr(string("Pressed",10))
bonjour
2 : LED.txt_MoveCursor(11,1) '' to trap ONLY the window of interest
if Flag1 == 1
Flag1 := 0
LED._putStr(string("RELEASED",10))
TouchCount1 := 50 '' Set Extinguish after release timeout
' 3 : LED.txt_MoveCursor(11,1)
' LED._putStr(string("MOVING ",10)) '' Not used in DEMO
' OldTouch1 := Touch1
if TouchCount1>0 '' Extinguish after release
TouchCount1--
if TouchCount1 == 0
LED.txt_MoveCursor(11,1)
LED._putStr(string(" ",10))
PUB bonjour | Touch3, OldTouch3, Flag3, TouchCount3, Touch2, OldTouch2, Flag2, TouchCount2
LED._putStr(string("Dis bonjour a bibi",10))
' LED.touch_Set(2)
LED.touch_DetectRegion(8,18,160,53)
LED.gfx_Rectangle(8,18,160,53,LED.RGB(255,255,0))
LED.gfx_Button(1,10,20,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("au revoir"))
LED.touch_DetectRegion(8,58,151,94)
LED.gfx_Rectangle(8,58,151,94,LED.RGB(255,255,0))
LED.gfx_Button(1,10,60,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("boujour"))
repeat
Touch3 := LED.touch_Get(0) ''<-Touch Detect 0-Screen STATUS
X3 := LED.touch_Get(1) ''<-Touch Detect 1-X coordinate
Y3 := LED.touch_Get(2) ''<-Touch Detect 2-Y coordinate
Touch2 := LED.touch_Get(0) ''<-Touch Detect 0-Screen STATUS
X2 := LED.touch_Get(1) ''<-Touch Detect 1-X coordinate
Y2 := LED.touch_Get(2)
if (Touch3 == 1)
if ((X3>=8 AND X3<= 151) AND (Y3>=53 AND Y3<=94 ))
if Touch3 <> OldTouch3
Case Touch3
0 : LED.txt_MoveCursor(11,1)
LED._putStr(string("pas touch
I am trying to create a menu. When I create only one touch area, it works but when I create two touch areas, it doesn't work.
The program runs but there are two touch areas that don't work fine
If anyone has a hint, I would appreciate
My program is the following:
[Code]
{
************************************************************************************************************
* *
* AUTO-RECOVER NOTICE: This file was automatically recovered from an earlier Propeller Tool session. *
* *
* ORIGINAL FOLDER: \parallax\ *
* TIME AUTO-SAVED: over 1 day ago (14/08/2014 00:21:48) *
* *
* OPTIONS: 1) RESTORE THIS FILE by deleting these comments and selecting File -> Save. *
* The existing file in the original folder will be replaced by this one. *
* *
* -- OR -- *
* *
* 2) IGNORE THIS FILE by closing it without saving. *
* This file will be discarded and the original will be left intact. *
* *
************************************************************************************************************
.}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5000000
rxpin = 3
txpin = 4
reset = 5
OLEDBaud = 115200
obj
LED : "uLCD(SK)-32PTU_v2.0"
var 'Used ONLY for DEMO
long Random,X[4],Y[4],Angle[4],OldX[4],OldY[4],C[8], stack1[50], stack2[50],Touch1, OldTouc1,TouchCount1,Flag1,i
word X1,X2,X3,Y1,Y2,Y3
PUB main
LED.start(rxpin, txpin, reset, OLEDBaud) ''Starts uOLED display
LED.touch_Set(0)
RentrerEnContact
PUB RentrerEnContact
LED.touch_DetectRegion(8,18,160,94)
LED.gfx_Rectangle(8,18,160,53,LED.RGB(255,255,0))
LED.gfx_Button(1,10,20,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("Rentrer en contact"))
' LED.touch_DetectRegion(8,58,151,94)
' LED.gfx_Rectangle(8,58,151,94,LED.RGB(255,255,0))
' LED.gfx_Button(1,10,60,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("Trouver personne"))
LED.txt_BGColor(LED.RGB(0,0,0)) ''Set FG/BG color text for PRESSED RELEASED
' txt_FGColor(color)
LED.txt_FGColor(LED.RGB(64,255,64))
i := 0
repeat
Touch1 := LED.touch_Get(0) ''<-Touch Detect 0-Screen STATUS
X1 := LED.touch_Get(1) ''<-Touch Detect 1-X coordinate
Y1 := LED.touch_Get(2) ''<-Touch Detect 2-Y coordinate
if (Touch1 == 1)
if ((X1>=8 AND X1<= 160) AND (Y1>=18 AND Y1<=53 ))
if Touch1 <> OldTouc1
LED.ClearScreen
Case Touch1
0 : LED.txt_MoveCursor(11,1)
'LED._putStr(string("NO TOUCH",10)) '' Not used in DEMO
1 : LED.txt_MoveCursor(11,1)
coucou
'telephone
2 : LED.txt_MoveCursor(11,1) '' to trap ONLY the window of interest
if Flag1 == 1
Flag1 := 0
LED._putStr(string("RELEASED",10))
TouchCount1 := 50 '' Set Extinguish after release timeout
' 3 : LED.txt_MoveCursor(11,1)
' LED._putStr(string("MOVING ",10)) '' Not used in DEMO
' OldTouch1 := Touch1
if TouchCount1>0 '' Extinguish after release
TouchCount1--
if TouchCount1 == 0
LED.txt_MoveCursor(11,1)
LED._putStr(string(" ",10))
PUB coucou | Touch2, OldTouch2, Flag2, TouchCount2
LED._putStr(string("Dis bijour a rorodolf",10))
' LED.touch_Set(0)
LED.touch_DetectRegion(8,18,160,53)
LED.gfx_Rectangle(8,18,160,53,LED.RGB(255,255,0))
LED.gfx_Button(1,10,20,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("coucou"))
repeat
Touch1 := LED.touch_Get(0) ''<-Touch Detect 0-Screen STATUS
X1 := LED.touch_Get(1) ''<-Touch Detect 1-X coordinate
Y1 := LED.touch_Get(2) ''<-Touch Detect 2-Y coordinate
if (Touch1 == 1)
if ((X1>=8 AND X1<= 160) AND (Y1>=18 AND Y1<=53 ))
if Touch1 <> OldTouc1
LED.ClearScreen
Case Touch1
0 : LED.txt_MoveCursor(11,1)
'LED._putStr(string("NO TOUCH",10)) '' Not used in DEMO
1 : LED.txt_MoveCursor(11,1)
LED._putStr(string("Pressed",10))
bonjour
2 : LED.txt_MoveCursor(11,1) '' to trap ONLY the window of interest
if Flag1 == 1
Flag1 := 0
LED._putStr(string("RELEASED",10))
TouchCount1 := 50 '' Set Extinguish after release timeout
' 3 : LED.txt_MoveCursor(11,1)
' LED._putStr(string("MOVING ",10)) '' Not used in DEMO
' OldTouch1 := Touch1
if TouchCount1>0 '' Extinguish after release
TouchCount1--
if TouchCount1 == 0
LED.txt_MoveCursor(11,1)
LED._putStr(string(" ",10))
PUB bonjour | Touch3, OldTouch3, Flag3, TouchCount3, Touch2, OldTouch2, Flag2, TouchCount2
LED._putStr(string("Dis bonjour a bibi",10))
' LED.touch_Set(2)
LED.touch_DetectRegion(8,18,160,53)
LED.gfx_Rectangle(8,18,160,53,LED.RGB(255,255,0))
LED.gfx_Button(1,10,20,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("au revoir"))
LED.touch_DetectRegion(8,58,151,94)
LED.gfx_Rectangle(8,58,151,94,LED.RGB(255,255,0))
LED.gfx_Button(1,10,60,LED.RGB(128,128,128),LED.RGB(255,255,255),2,1,2,string("boujour"))
repeat
Touch3 := LED.touch_Get(0) ''<-Touch Detect 0-Screen STATUS
X3 := LED.touch_Get(1) ''<-Touch Detect 1-X coordinate
Y3 := LED.touch_Get(2) ''<-Touch Detect 2-Y coordinate
Touch2 := LED.touch_Get(0) ''<-Touch Detect 0-Screen STATUS
X2 := LED.touch_Get(1) ''<-Touch Detect 1-X coordinate
Y2 := LED.touch_Get(2)
if (Touch3 == 1)
if ((X3>=8 AND X3<= 151) AND (Y3>=53 AND Y3<=94 ))
if Touch3 <> OldTouch3
Case Touch3
0 : LED.txt_MoveCursor(11,1)
LED._putStr(string("pas touch
Comments
http://obex.parallax.com/object/722
Apparently it has been removed by Parallax for an unknown reason...
Might still be somewhere on the forum.
Here is the library (uLCD(SK)-32PTU_v2.0) that I managed to download when it was still available on the parallax site.
uLCD(SK)-32PTU_v2.0.spin
Also, the last instance, is missing an equals sign = from the "Y2<53"