picaxester
Senior Member
Heres a useless little program that I made to make it a bit easier to use the PICAXE chips in Linux
Video
It's written in FreeBASIC
Video
It's written in FreeBASIC
Code:
dim as integer i, x, y, buttons
dim shared chip as string
dim as string s, usb, fname
dim text(15) as string
declare sub black
screenres 387,300
draw string (18,21), "08"
draw "BM10,11 D26 R1 D1 R1 D1 R26 U1 R1 U1 R1 U26 L1 U1 L1 U1 L26 D1 L1 D1 L1"
draw string (58,21), "08M"
draw "BM50,11 D26 R1 D1 R1 D1 R34 U1 R1 U1 R1 U26 L1 U1 L1 U1 L34 D1 L1 D1 L1"
draw string (106,21), "14M"
draw "BM98,11 D26 R1 D1 R1 D1 R34 U1 R1 U1 R1 U26 L1 U1 L1 U1 L34 D1 L1 D1 L1"
draw string (154,21), "18"
draw "BM146,11 D26 R1 D1 R1 D1 R26 U1 R1 U1 R1 U26 L1 U1 L1 U1 L26 D1 L1 D1 L1"
draw string (194,21), "18A"
draw "BM186,11 D26 R1 D1 R1 D1 R34 U1 R1 U1 R1 U26 L1 U1 L1 U1 L34 D1 L1 D1 L1"
draw string (242,21), "18X"
draw "BM234,11 D26 R1 D1 R1 D1 R34 U1 R1 U1 R1 U26 L1 U1 L1 U1 L34 D1 L1 D1 L1"
draw string (290,21), "18X1"
draw "BM282,11 D26 R1 D1 R1 D1 R42 U1 R1 U1 R1 U26 L1 U1 L1 U1 L42 D1 L1 D1 L1"
draw string (346,21), "20M"
draw "BM338,11 D26 R1 D1 R1 D1 R34 U1 R1 U1 R1 U26 L1 U1 L1 U1 L34 D1 L1 D1 L1"
draw string (18,62), "28"
draw "BM10,52 D26 R1 D1 R1 D1 R26 U1 R1 U1 R1 U26 L1 U1 L1 U1 L26 D1 L1 D1 L1"
draw string (58,62), "28A"
draw "BM50,52 D26 R1 D1 R1 D1 R34 U1 R1 U1 R1 U26 L1 U1 L1 U1 L34 D1 L1 D1 L1"
draw string (106,62), "28X"
draw "BM98,52 D26 R1 D1 R1 D1 R34 U1 R1 U1 R1 U26 L1 U1 L1 U1 L34 D1 L1 D1 L1"
draw string (154,62), "28X1"
draw "BM146,52 D26 R1 D1 R1 D1 R42 U1 R1 U1 R1 U26 L1 U1 L1 U1 L42 D1 L1 D1 L1"
draw string (210,62), "28X1_0"
draw "BM202,52 D26 R1 D1 R1 D1 R58 U1 R1 U1 R1 U26 L1 U1 L1 U1 L58 D1 L1 D1 L1"
draw string (282,62), "28X_1"
draw "BM274,52 D26 R1 D1 R1 D1 R50 U1 R1 U1 R1 U26 L1 U1 L1 U1 L50 D1 L1 D1 L1"
draw string (346,62), "USB"
draw "BM338,52 D26 R1 D1 R1 D1 R34 U1 R1 U1 R1 U26 L1 U1 L1 U1 L34 D1 L1 D1 L1"
draw string (338,104), "EXIT"
draw "BM330,94 D26 R1 D1 R1 D1 R42 U1 R1 U1 R1 U26 L1 U1 L1 U1 L42 D1 L1 D1 L1"
draw string (258,104), "COMPILE"
draw "BM250,94 D26 R1 D1 R1 D1 R66 U1 R1 U1 R1 U26 L1 U1 L1 U1 L66 D1 L1 D1 L1"
'draw string (18,104), "PROGRAM NAME AND OUTPUT"
draw "BM10,94 D26 R1 D1 R1 D1 R226 U1 R1 U1 R1 U26 L1 U1 L1 U1 L226 D1 L1 D1 L1"
chip = "./picaxe08"
usb = " -c/dev/ttyS0 "
do while inkey$ = ""
do while buttons < 1
getmouse (x, y, , buttons)
s = inkey$
if s = chr(255) & "k" then end
if s = chr(27) then end
sleep 10
loop
'08
if x > 10 and x < 40 and y > 11 and y < 41 then
black
draw "BM12,13 P8, 15"
chip = "./picaxe08"
'08M
elseif x > 50 and x < 88 and y > 11 and y < 41 then
black
draw "BM52,13 P8, 15"
chip = "./picaxe08m"
'14M
elseif x > 98 and x < 136 and y > 11 and y < 41 then
black
draw "BM100,13 P8, 15"
chip = "./picaxe14m"
'18
elseif x > 146 and x < 176 and y > 11 and y < 41 then
black
draw "BM148,13 P8, 15"
chip = "./picaxe18"
'18A
elseif x > 186 and x < 224 and y > 11 and y < 41 then
black
draw "BM188,13 P8, 15"
chip = "./picaxe18a"
'18X
elseif x > 234 and x < 272 and y > 11 and y < 41 then
black
draw "BM236,13 P8, 15"
chip = "./picaxe18x"
'18X1
elseif x > 282 and x < 328 and y > 11 and y < 41 then
black
draw "BM284,13 P8, 15"
chip = "./picaxe18x_1"
'20M
elseif x > 338 and x < 376 and y > 11 and y < 41 then
black
draw "BM340,13 P8, 15"
chip = "./picaxe20m"
'28
elseif x > 10 and x < 40 and y > 52 and y < 82 then
black
draw "BM12,54 P8, 15"
chip = "./picaxe28"
'28A
elseif x > 50 and x < 88 and y > 52 and y < 82 then
black
draw "BM52,54 P8, 15"
chip = "./picaxe28a"
'28X
elseif x > 98 and x < 136 and y > 52 and y < 82 then
black
draw "BM100,54 P8, 15"
chip = "./picaxe28x"
'28X1
elseif x > 146 and x < 192 and y > 52 and y < 82 then
black
draw "BM148,54 P8, 15"
chip = "./picaxe28x1"
'28X1_0
elseif x > 202 and x < 264 and y > 52 and y < 82 then
black
draw "BM204,54 P8, 15"
chip = "./picaxe28x1_0"
'28X_1
elseif x > 274 and x < 328 and y > 52 and y < 82 then
black
draw "BM276,54 P8, 15"
chip = "./picaxe28x_1"
'USB
elseif x > 338 and x < 376 and y > 52 and y < 82 then
if usb = " -c/dev/ttyS0 " then
draw "BM340,54 P8, 15"
usb = " "
elseif usb = " " then
draw "BM340,54 P0, 15"
usb = " -c/dev/ttyS0 "
end if
'EXIT
elseif x > 330 and x < 376 and y > 94 and y < 124 then
end
'COMPILE
elseif x > 250 and x < 320 and y > 94 and y < 124 then
locate 17, 1
for i = 1 to 15
print " "
next i
locate 1, 20
print "Wait..."
open pipe "cd ~; cd Documents/PICAXE; sudo " & chip & usb & fname for input as #1
for i = 1 to 15
line input #1, text(i)
next i
locate 17, 1
for i = 1 to 15
if text(i) > "" then
print text(i)
end if
next i
close #1
locate 1, 20
print " "
'FILE NAME
elseif x > 10 and x < 208 and y > 94 and y < 124 then
locate 14, 3
print " "
locate 14, 3
input "", fname
end if
getmouse (x, y, , buttons)
do while x > 1 and buttons > 0
getmouse (x, y, , buttons)
sleep 10
loop
loop
Sub black()
chip = ""
draw "BM12,13 P0, 15"
draw "BM52,13 P0, 15"
draw "BM100,13 P0, 15"
draw "BM148,13 P0, 15"
draw "BM188,13 P0, 15"
draw "BM236,13 P0, 15"
draw "BM284,13 P0, 15"
draw "BM340,13 P0, 15"
draw "BM12,54 P0, 15"
draw "BM52,54 P0, 15"
draw "BM100,54 P0, 15"
draw "BM148,54 P0, 15"
draw "BM204,54 P0, 15"
draw "BM276,54 P0, 15"
End Sub
Last edited: