Post by honky on Apr 22, 2023 12:35:49 GMT
For fun:
[/div][div] NOMAINWIN
mapw=500: maph= 550
WindowWidth=mapw+15: WindowHeight=maph+40
UpperLeftX = 10: UpperLeftY = 5
TEXTBOX #w.pin, 20, 40, 50, 30
TEXTBOX #w.ta, 120, 40, 80, 30
TEXTBOX #w.tb, 240, 40, 80, 30
BUTTON #w.ok, "<--Go !", [go], UL, 340, 40, 60, 25
BUTTON #w.save, "Save", [save], UL, 420, 40, 60, 25
TEXTEDITOR #w.ext, 10, 90, 490, 420
GRAPHICBOX #w.g, 5, 5, mapw, maph
OPEN "Code Arduino Blink interface" FOR window_nf AS #w
#w, "TRAPCLOSE [closeHelp]"
#w.g, "down;fill darkpink;color white;backcolor darkpink"
#w.g, "font courrier 12 bold"
#w.pin, "!font courrier 12 bold": #w.ta, "!font courrier 12 bold": #w.tb, "!font courrier 12 bold"
#w.ok, "!font courrier 12 bold": #w.save, "!font courrier 12 bold"
#w.g, "place 30 25": #w.g, "\Pin N°"
#w.g, "place 120 25": #w.g, "\On": #w.g, "place 240 25": #w.g, "\Off"
#w.ext, "!font courrier 12 BOLD"
#w.pin, "12": #w.ta, "500": #w.tb, "1000"
#w.g, "flush"
wait
[go]
#w.pin, "!contents? pin$": pin=val(pin$)
#w.ta, "!contents? ta$": ta=val(ta$): #w.tb, "!contents? tb$": tb=val(tb$)
if pin$="" or ta$="" or tb$="" then
notice,"Param missing": wait
end if
#w.ext, "#define PIN_OUT ";pin$
#w.ext, "void setup()"
#w.ext, "{"
#w.ext, " pinMode(PIN_OUT, OUTPUT);"
#w.ext, "}"
#w.ext, "void loop()"
#w.ext, "{"
#w.ext, " digitalWrite(PIN_OUT, HIGH);"
#w.ext, " delay(";ta$;");"
#w.ext, " digitalwrite(PIN_OUT, LOW);"
#w.ext, " delay(";tb$;");"
#w.ext, "}"
#w.g, "place 30 520": #w.g, "\Select All...Copy...Paste in Arduino IDE"
wait
' [save]
#w.ext, "!contents? code$"
open "CODE Arduno.txt" for output as #f
print #f, code$
close #f
#w.g, "color darkpink;backcolor darkpink"
#w.g, "place 20 505": #w.g, "boxFILLED 490 530"
#w.g, "color white"
#w.g, "place 30 520": #w.g, "\Code .txt is in the Folder"
wait
[closeHelp]
CLOSE #w
END