|
Post by tenochtitlanuk on May 2, 2021 15:19:14 GMT -5
Are you using LB 4.5 on 64 bit machines? Did you really mean LM186, and why the mention of I2C?? But as Rod says, there are much easier ways to read analog values, unless you need a high speed conversion- eg see my page at www.diga.me.uk/serialADCreadLinux.html
|
|
|
Post by tenochtitlanuk on Apr 7, 2021 16:44:50 GMT -5
The code shown here flips visibility of two boxes at the same position- may help you see what to do..
nomainwin
WindowWidth =300 WindowHeight =170
texteditor #w.te1, 10, 10, 240, 80 texteditor #w.te2, 10, 10, 240, 80
global state: stete =0
open "Demo" for window as #w
#w "trapclose quit" #w "font Arial 24 bold"
#w.te1 "!forecolor red" #w.te1 "!backcolor cyan" #w.te1 " Text 1"
#w.te2 "!forecolor darkblue" #w.te2 "!backcolor yellow" #w.te2 " Text 2"
timer 100, [swapEm]
wait
[swapEm] state =state +1 #w.te1 "!cls" #w.te1 using( "#####.", state); " swaps" #w.te2 "!cls" #w.te2 using( "#####.", state); " swaps" if state mod 2 =0 then #w.te1 "!show": #w.te2 "!hide" if state mod 2 =1 then #w.te1 "!hide": #w.te2 "!show" wait
sub quit h$ close #h$ end end sub
|
|
|
Post by tenochtitlanuk on Mar 29, 2021 3:41:57 GMT -5
|
|
|
Post by tenochtitlanuk on Mar 28, 2021 8:46:57 GMT -5
PS- I wondered why the wget method did't seem to work for me on Linux Mint, LB 4.t, then realised I was trying to read the file before wget had finished downloading it!
|
|
|
Post by tenochtitlanuk on Mar 19, 2021 14:29:48 GMT -5
Actually I think you re confusind subs ( which are 'called' in LB) and gosubs, which end by returning.
Look at the example below- it creates a csv file whether called as a sub, or when called by trapclose.
Results are three files- and a screen display which closes. We're not exactly sure what the conditions are for your "BLANK" but this should give you an idea??
nomainwin
global p$ p$ ="Stay"
open "Demo" for text as #w ' so can see the generated terms..
#w "!trapclose QuitAndSave"
dim user$( 11, 6)
for i =1 to 11 for j =1 to 6 user$( i, j) =chr$( 65 +int( 26 *rnd( 1))) +chr$( 48 +int( 10 *rnd( 1))) #w user$( i, j) +","; next j #w "" next i
call QuitAndSave p$
p$ ="stillStay" call QuitAndSave p$
p$ ="Quitting"
wait
sub QuitAndSave p$ if p$ ="#w" then p$ ="Quitting" open "Settings_" +p$ +".csv" for output as #fOut for i = 1 to 11 for j = 1 to 6 #fOut user$( i, j) +","; next j #fOut chr$( 13); next i
close #fOut
if p$ ="Quitting" then close #w: end ' if we are really finishing... end sub
|
|
|
Post by tenochtitlanuk on Mar 19, 2021 7:32:01 GMT -5
Why do you not want to store them locally anyway? Your LB line has already temporarily stored them locally in a variable. Just save the downloaded images to files! Since they are large images, 24 bit, at 1828x100, you CAN show them in a graphic window. But you would probably want to resize them to fit a smaller window unless you have a very high res. monitor display. I use ImageMagick called from LB to do this kind of thing, but it's even easier to download them and resize to a standard size ( ie thumbnail) for LB to display.It's also easy to programmatically delete the downloaded image files.
myimage$ = HTTPGet$( "https://emea-presales.s3.eu-west-2.amazonaws.com/general/imagelib/image1.bmp") open "imageLocal.bmp" for output as #fOut #fOut, myimage$; close #fOut
|
|
|
Post by tenochtitlanuk on Mar 2, 2021 3:38:02 GMT -5
When I run your code it saves four files CALLED bmp, but actually jpegs! Didn't look further. LB4 can't directly load jpg.
|
|
|
Post by tenochtitlanuk on Feb 21, 2021 4:24:03 GMT -5
Well put Anatoly. Agree strongly with all your points...
EDIT' Many of my generation really got into programming on the BBC Computer. From the BBC computer manual..
-5 This shows one of the few ‘unary’ operators that we are used to. The - just acts on the 5 to make it a negative number.
|
|
|
Post by tenochtitlanuk on Feb 16, 2021 12:13:06 GMT -5
I needed some stick-on labels to customise this year's jam and marmalade production.
|
|
|
Post by tenochtitlanuk on Feb 16, 2021 11:19:32 GMT -5
It also throws the debugger.... try single-stepping through it.
|
|
|
Post by tenochtitlanuk on Feb 12, 2021 4:38:19 GMT -5
|
|
|
Post by tenochtitlanuk on Feb 8, 2021 4:16:50 GMT -5
You might be interested in a page on my LB site, where I was generating and displaying SVG files destined to drive my home-built EggBot. See Generating SVG files.
|
|
|
Post by tenochtitlanuk on Feb 7, 2021 11:18:47 GMT -5
Arrays need to be 'dimensioned' in advance- otherwise they default to 10 entries.
Try a line like this, early in the program...
dim setuparray$( 50)
|
|
|
Post by tenochtitlanuk on Feb 3, 2021 11:45:20 GMT -5
|
|
|
Post by tenochtitlanuk on Feb 2, 2021 18:21:28 GMT -5
That's a complex page on NBA, constructed without the data being in the page code, but fetched from a database.
Webpages are increasingly coded to customise them to you and convey data to you visually, but not to make it easy for you to get out what you want!
I used to run a LB program daily to download a synoptic weather chart. Now the equivalent page is built by tiling separate sections and MUCH harder to grab as a single image.
For fun I've written LB code that opens a texteditor. You MANUALLY click/drag through the NBA page's data section, and paste into the LB window, and it strips out the bits you want/don't want, and saves as a csv file. Seems to work fine...
LB could open that in a spreadsheet app of your choice.
Will put up code and how-to if it's any use to you. It gave me an hour or two of fun anyway!
|
|