Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3563e62
commit 25a8404
Showing
26 changed files
with
1,024 additions
and
29,309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
' AUTORUN uses file selection utility by Carsten Meyer, cm@ct.de 8/2013 | ||
option usb off | ||
FileSelect("*.bas", 0) ' open a .bas file | ||
|
||
Mode 3: Cls: Font #1: Color white, black | ||
touch remove all | ||
if filename$="Cancel" then | ||
run | ||
endif | ||
run filename$ | ||
|
||
|
||
sub FileSelect(FileMask$, saveBtn) | ||
' file selection utility by Carsten Meyer, cm@ct.de 8/2013 | ||
' returns filename$ (is "NewFile" if NEW selected and saveBtn=1) | ||
local i, x, x_old, y, y_old, firststart | ||
dim file_arr$(20) | ||
settick 0, 0 ' disable Interrupt | ||
file_arr$(0)= dir$(FileMask$,FILE) 'change file extension to your needs | ||
for i = 1 to 20 | ||
file_arr$(i)=dir$() | ||
next i | ||
cls:font #2:color white, black:locate 0,0 | ||
for i = 10 to 19 | ||
print tab(20) format$(i, "%02.0f") ": " file_arr$(i) | ||
next i | ||
locate 0,0 | ||
for i = 0 to 9 | ||
print format$(i, "%02.0f") ": " file_arr$(i) | ||
next i | ||
font #1:Color green, black | ||
print @(0,250) "touch file to select..." | ||
touch release | ||
touch remove all | ||
touch size 462,185 'set dummy button size | ||
touch create 9,5,5,"",0,n,d ' None (dummy button), disable automatic touch handling | ||
touch size 100,35 'set new bigger button size | ||
if saveBtn then | ||
touch create 2,150,220,"NEW",red,B | ||
touch create 1,260,220,"SAVE",green,B | ||
touch create 0,370,220,"CANCEL",cyan,B | ||
else | ||
touch create 1,260,220,"OPEN",green,B | ||
touch create 0,370,220,"CANCEL",cyan,B | ||
endif | ||
line(0,0)-(239,19),-1,bf | ||
filenum = 0 : x_old = 0 : y_old = 0 : firststart = 1 | ||
do | ||
'touch Check ' handle all buttons/switch events | ||
font #2 | ||
colour green, black | ||
print @(0,220) time$ | ||
if touched(9) then ' dummy button | ||
x = touched(#X) \ 240 ' recent coordinates, integer division | ||
y = touched(#Y) \ 20 | ||
if y < 10 then | ||
x = x * 10 | ||
if x <> x_old or y <> y_old or firststart then | ||
' select file by touch, invert rect | ||
line(x_old*24,y_old*20)-(x_old*24+239,y_old*20+19),-1,bf | ||
font #2 | ||
line(x*24,y*20)-(x*24+239,y*20+19),-1,bf | ||
if x+y <> filenum then | ||
touch Beep (1) | ||
endif | ||
filenum = x+y | ||
firststart = 0 | ||
endif | ||
endif | ||
x_old = x : y_old = y | ||
endif | ||
if touchval(0) then | ||
filename$="Cancel" | ||
erase file_arr$ | ||
touch remove all | ||
exit sub | ||
endif | ||
if touchval(1) then | ||
' return a filename | ||
filename$=file_arr$(filenum) | ||
if filename$<>"" then | ||
erase file_arr$ | ||
touch remove all | ||
exit sub | ||
endif | ||
endif | ||
if touchval(2) then 'might be -1 for not initialised | ||
' New, return filename "NewFile" | ||
filename$="NewFile" | ||
erase file_arr$ | ||
touch remove all | ||
exit sub | ||
endif | ||
pause 50 ' we have some time left over, may be used for other things | ||
loop | ||
end sub | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
DIM needle_arr(3) | ||
|
||
Mode 3 | ||
Cls | ||
FONT #1 | ||
|
||
SetPin 1,1 | ||
SetPin 2,1 | ||
SetPin 3,1 | ||
|
||
ParamName$ = "DEATH RATE" | ||
plot_grid 0, 0, 300 | ||
ParamName$ = "GERBIL SPEED" | ||
plot_scale 200, 0, 100 | ||
sinrad=0 | ||
|
||
Touch Size 80,25 | ||
Touch Create 9,390,240,"EXIT",green,B | ||
Touch Size 25,100 'set vertical slider size - drawed item is somewhat longer due to knob | ||
Touch Create 5,430,5,"",blue,V,B ' Vertical slider, fill Bottom side | ||
Touch Size 165,30 'set horizontal slider size | ||
Touch Create 3,0,180,"",green,H,LND ' fill left side, no knob, disable automatic touch (-) | ||
Touch Size 80,20 | ||
Touch Create 7,20,220,"Faster!",white,C 'create and draw a checkbox | ||
|
||
do | ||
my_sine=sin(sinrad) | ||
if TouchVal(5) > 80 then | ||
Touch Beep 100 | ||
TouchVal(5)=80 | ||
endif | ||
TouchVal(3)=my_sine*20 + 30 | ||
plot_graph 0, 0, my_sine*50+50, 300 | ||
plot_needle 200, 0, TouchVal(5)+my_sine*15+15, 100, 2 | ||
sinrad=sinrad + 0.1 + TouchVal(7)*0.2 | ||
|
||
' pause 20 | ||
|
||
if TouchVal(9) then | ||
Touch Remove All | ||
run "AUTORUN.BAS" | ||
endif | ||
|
||
loop | ||
|
||
|
||
sub plot_scale (x, y, max_s) | ||
local center_x, center_y | ||
center_x = x + 84 | ||
center_y = y + 120 | ||
' Analog-Zeigerinstrument, Aufhängung der Nadel = Center | ||
line (center_x - 84, center_y - 120) - (center_x + 84, center_y + 20), blue, B | ||
line (center_x - 83, center_y - 119) - (center_x + 83, center_y + 19), white, BF | ||
FONT #1 | ||
color black | ||
For i= 0 To 20 | ||
rads=(i-10)*pi/40 | ||
x2=Sin(rads)*100 + center_x | ||
y2=-Cos(rads)*100 + center_y | ||
If i Mod 4 <> 0 Then | ||
x1=Sin(rads)*95 + center_x | ||
y1=-Cos(rads)*95 + center_y | ||
Else | ||
x1=Sin(rads)*90 + center_x | ||
y1=-Cos(rads)*90 + center_y | ||
print @(x2-12,y2-14,1) (max_s*i/20) | ||
EndIf | ||
Line(x1,y1)-(x2,y2),blue | ||
Next i | ||
FONT #2 | ||
color yellow | ||
print @(center_x-84,center_y+25) ParamName$ | ||
end sub | ||
|
||
sub plot_needle (x, y, needle_v, max_s, needle_idx) | ||
' Analog-Zeigerinstrument, Aufhängung der Nadel = Center | ||
local my_needle, center_x, center_y | ||
center_x = x + 84 | ||
center_y = y + 120 | ||
my_needle= needle_v * 100 / max_s | ||
' needle value 0..100 | ||
if my_needle <> needle_arr(needle_idx) then | ||
circle(center_x, center_y), 8, blue | ||
rads= (needle_arr(needle_idx)-50)*pi/200 | ||
x2=Sin(rads)*90 + center_x | ||
y2=-Cos(rads)*90 + center_y | ||
Line(center_x,center_y)-(x2,y2),white | ||
|
||
rads= (my_needle-50)*pi/200 | ||
x2=Sin(rads)*90 + center_x | ||
y2=-Cos(rads)*90 + center_y | ||
Line(center_x,center_y)-(x2,y2),red | ||
color red, black | ||
FONT #2 | ||
print @(center_x+15,center_y-9) format$(needle_v, "%5.1f") | ||
endif | ||
needle_arr(needle_idx) = my_needle | ||
end sub | ||
|
||
sub plot_grid (x, y, max_s) | ||
local center_x, center_y | ||
center_x = x + 84 | ||
center_y = y + 70 | ||
|
||
FONT #1 | ||
color blue | ||
print @(center_x-78,center_y+40) 0 | ||
print @(center_x-78,center_y-10) max_s/2 | ||
print @(center_x-78,center_y-60) max_s | ||
line (center_x - 84, center_y - 70) - (center_x + 84, center_y + 70), blue, B | ||
For i= -2 To 2 | ||
Line(center_x - 80, center_y + (i*25))-(center_x + 80, center_y + (i*25)), blue | ||
Next i | ||
For i= -3 To 3 | ||
Line(center_x + (i*25), center_y - 67)-(center_x + (i*25), center_y + 67), blue | ||
Next i | ||
FONT #2 | ||
color yellow | ||
print @(center_x-84,center_y+77) ParamName$ | ||
end sub | ||
|
||
sub plot_graph (x, y, graph_v, graph_max) | ||
local center_x, center_y | ||
center_x = x + 84 | ||
center_y = y + 70 | ||
FONT #1 | ||
BLIT center_x - 82, center_y - 50, center_x -83, center_y - 50, 167, 101, g | ||
PIXEL(center_x + 83, center_y + 50 - graph_v) = green | ||
|
||
end sub | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | ||
' Demonstration of Colour MMBasic | ||
' Geoff Graham, June 2012 | ||
' TFT Touchscreen by Carsten Meyer | ||
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | ||
|
||
Mode 3 | ||
Cls | ||
cx = MM.HRes/2 : cy = MM.VRes/2 | ||
Touch Size 120,40 'set new bigger button size | ||
Touch Create 0,180,116,"EXIT",red,B | ||
|
||
' draw random circles with smaller circles near to the centre | ||
i = 0 | ||
Do | ||
Do | ||
x = Rnd * MM.HRes ' horiz center of the circle | ||
y = Rnd * MM.VRes ' vert center of the circle | ||
c = Int(Rnd * 6) + 1 ' the colour | ||
Loop Until Pixel(x, y) <> c ' must be different | ||
d = Sqr(Abs(x-cx)^2 + Abs(y-cy)^2) ' distance from the centre | ||
r = Rnd * d/8 + 2 + d/14 ' radius | ||
Circle (x,y), r, c, f ' draw the sphere | ||
If r > Rnd*8 + 13 Then Circle (x,y), r+1, 0 ' draw the edge in black | ||
i= i+1 | ||
If i>99 Then | ||
' redraw overwritten button regularily | ||
Touch Item Create 0,180,116,"EXIT",c,B | ||
i=0 | ||
endif | ||
'Touch Check ' handle all buttons/switch events | ||
If TouchVal(0) then | ||
Touch Remove all ' make touch items invalid, don't redraw | ||
cls black | ||
colour white, black | ||
font #2 | ||
print: print "Good Bye" | ||
font #1 | ||
Pause 500 | ||
run "autorun.bas" | ||
endif | ||
Loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | ||
' Demonstration of the colour modes in Colour MMBasic | ||
' Geoff Graham May 2012 | ||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | ||
|
||
Data "Black ", " Blue ", "Green ", " Cyan " | ||
Data " Red ", "Purple", "Yellow", "White " | ||
Data Red, Yellow, Green, Red, Blue, Purple, Red, Cyan, White | ||
Data Green, Cyan, Blue, Green, Purple, White, Yellow, Blue, White | ||
Dim c$(8) | ||
Dim p(9, 2) | ||
For i = 0 To 7: Read c$(i) : Next | ||
For i = 1 To 6: For j = 0 To 2 : Read p(i, j) : Next i, j | ||
|
||
Option usb off | ||
Cls | ||
mspc = 15 | ||
Mode 3 | ||
Colour 7 | ||
Font #1 | ||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | ||
Print "Monochrome Mode"; | ||
Line (0, MM.VPos+10)-(MM.HPos-2, MM.VPos+10), 7 | ||
Locate 0, MM.VPos + 5 | ||
Print "Any one colour can be selected for all output:" | ||
Locate 0, MM.VPos + 5 | ||
For i = Blue To White | ||
Colour i | ||
Print " MODE 1," Str$(i) " "; | ||
Next | ||
For i = Blue To White | ||
Colour i | ||
Print " " c$(i) " "; | ||
Next | ||
|
||
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | ||
Print @(0, MM.VPos + mspc) "Four colour mode"; | ||
Line (0, MM.VPos+10)-(MM.HPos-2, MM.VPos+10), 7 | ||
Locate 0, MM.VPos + 5 | ||
Print "Six colour palettes to chose from." | ||
Print "Each palette consists of three colours plus black:" ; | ||
For i = 1 To 6 | ||
Print @(20, MM.VPos + 17) "Palette" i " MODE 2," Str$(i) " "; | ||
For j = 0 To 2 | ||
Colour Black, p(i, j) | ||
Print " "; | ||
Colour White, Black | ||
Print " "; | ||
Next | ||
Print " ("; | ||
For j = 0 To 2 | ||
Colour p(i, j) | ||
Print " " c$(p(i, j)) " "; | ||
Next | ||
Colour White | ||
Print ")"; | ||
Next | ||
|
||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | ||
Print @(0, MM.VPos + mspc) "Eight colour mode"; | ||
Line (0, MM.VPos+10)-(MM.HPos-2, MM.VPos+10), 7 | ||
Locate 0, MM.VPos + 5 | ||
Print "MODE 3 All colours can be used simultaneously" | ||
line3 = MM.VPos | ||
height3 = 40 | ||
For i = 0 To MM.HRes | ||
If (i \ (MM.HRes\8)) + 1 > 7 Then Exit For | ||
Line (i, line3)-(i + height3, line3 + height3), (i \ (MM.HRes\8)) + 1 | ||
Next | ||
|
||
|
||
Touch Size 120,40 'set new bigger button size | ||
Touch Create 0,350,220,"EXIT",red,B | ||
|
||
do | ||
'Touch Check ' handle all buttons/switch events | ||
If TouchVal(0) then | ||
Touch Remove 0 ' make touch items invalid, don't redraw | ||
cls black | ||
colour white, black | ||
font #2 | ||
print: print "Good Bye" | ||
font #1 | ||
Pause 1000 | ||
run "autorun.bas" | ||
endif | ||
Pause 100 ' we have some time left over for debounce, may be used for other things | ||
loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Mode 3 | ||
Cls | ||
Locate 0,0 | ||
|
||
Touch Size 80,25 | ||
Touch Create 1,50,50,"LED1",red,L,d 'LED, Disabled touch (-) | ||
Touch Size 120,40 'set new bigger button size | ||
Touch Create 2,50,120,"LEDBTN2",green,L 'LED | ||
Touch Create 3,50,180,"LED3",red,L,d 'LED disabled | ||
Touch Create 9,350,220,"EXIT",green,B | ||
TouchVal(2)=1 'switch LED on manually | ||
TouchVal(3)=1 'switch LED on manually | ||
|
||
do | ||
TouchVal(1)=0 | ||
pause 500 | ||
TouchVal(1)=1 | ||
pause 500 | ||
if TouchVal(9) then | ||
Touch Remove All | ||
Cls black | ||
run "AUTORUN.BAS" | ||
endif | ||
|
||
loop |
Oops, something went wrong.