![]() |
Forum Index : Microcontroller and PC projects : Wave Share O Scope
Author | Message | ||||
hitsware2![]() Guru ![]() Joined: 03/08/2019 Location: United StatesPosts: 719 |
Click here for a good time ! SetPin gp13, dout: Pin(gp13)=1: CLS ' set screen Text 120,300,"V",cmn,3 ' draw controls Text 120,180,"V",cmi,3 Text 060,240,"V",cmd,3 Text 180,240,"V",cmu,3 Dim a(240),y%(240): h%=240: v%=40 ' set controls ' h% = horizontal gain Do : ADC open h%*1000,1 ' v% = verticle gain t%=(Touch(x)*Touch(y))/10000 ' adjust controls Select Case t% Case 2: v%=v%*1.1: Case 4: v%=v%/1.1 Case 5: h%=h%*1.1: Case 1: h%=h%/1.1 End Select If h%>500 Then h%=500: If h%<005 Then h%=005 If v%>200 Then v%=200: If v%<1 Then v%=1 ADC start a(): For x%=0 To 240 ' aquire y%(x%)= 80+((1.65-a(x%))*v%) Pixel x%,y%(x%): Next x%: Pause 100 ' trace For x%=0 To 240: Pixel x%,y%(x%),0 ' blank trace Next x%: ADC close: Loop my site |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5089 |
Nice find multiplying the X and Y touch coordinates and use the result in a select case statement. You are starting and stopping the ADC every time ? Even if no changes ? PicomiteVGA PETSCII ROBOTS |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
That is a neat way of converting touch coordinates to select case statements! I'm going to have to ponder that for my Green Hills maze program port to the '170 with touchscreen. I don't think If h%>500 Then h%=500: If h%<005 Then h%=005 works as expected. The second IF never executes usefully.Visit Vegipete's *Mite Library for cool programs. |
||||
hitsware2![]() Guru ![]() Joined: 03/08/2019 Location: United StatesPosts: 719 |
Not now ......I think I see what You mean .... Could only adjust on ' touches ' SetPin gp13, dout: Pin(gp13)=1:CLS Text 120,300,"V",cmn,3 Text 120,180,"V",cmi,3 Text 060,240,"V",cmd,3 Text 180,240,"V",cmu,3 Dim a(240),y%(240): h%=240: v%=40 ADC open 240000,1 Do : ADC frequency h%*1000 t%=(Touch(x)*Touch(y))/10000 Select Case t% Case 2: v%=v%*1.1: Case 4: v%=v%/1.1 Case 5: h%=h%*1.1: Case 1: h%=h%/1.1 End Select If h%>500 Then h%=500 If h%<005 Then h%=005 If v%>200 Then v%=200 If v%<001 Then v%=001 ADC start a(): For x%=0 To 240 y%(x%)= 80+((1.65-a(x%))*v%) Pixel x%,y%(x%): Next x%: Pause 100 For x%=0 To 240: Pixel x%,y%(x%),0 Next x%: Loop my site |
||||
hitsware2![]() Guru ![]() Joined: 03/08/2019 Location: United StatesPosts: 719 |
You are oh so right ..... SetPin gp13, dout: Pin(gp13)=1:CLS Text 120,300,"V",cmn,3 Text 120,180,"V",cmi,3 Text 060,240,"V",cmd,3 Text 180,240,"V",cmu,3 Dim a(240),y%(240): h%=240: v%=40 ADC open 240000,1 Do : ADC frequency h%*1000 t%=(Touch(x)*Touch(y))/10000 Select Case t% Case 2: v%=v%*1.1: Case 4: v%=v%/1.1 Case 5: h%=h%*1.1: Case 1: h%=h%/1.1 End Select If h%>500 Then h%=500 If h%<005 Then h%=005 If v%>200 Then v%=200 If v%<001 Then v%=001 ADC start a(): For x%=0 To 240 y%(x%)= 80+((1.65-a(x%))*v%) Pixel x%,y%(x%): Next x%: Pause 100 For x%=0 To 240: Pixel x%,y%(x%),0 Next x%: Loop my site |
||||
hitsware2![]() Guru ![]() Joined: 03/08/2019 Location: United StatesPosts: 719 |
Sometimes Knobs are Nicer Dim a!(127) Do SetPin gp28, ain: v% = Pin(gp28) * 30 SetPin gp27, ain: h% = Pin(gp27) * 150000 ADC open h%+1,1 Pause 200 CLS ADC start a!() For x%=0 To 127 Pixel x%,32+((1.65-a!(x%))*v%) Next x% ADC close Loop ESC:Exit F1:Save F2:Run F3:Find F4:Mark F5:Paste Ln: 1 Col: 1 INS Edited 2022-04-25 10:14 by hitsware2 my site |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |