![]() |
Forum Index : Microcontroller and PC projects : A very BASIC question
![]() ![]() |
|||||
Author | Message | ||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
Loading from a variable apparently doesn't work (I don't know why that needs to be the case). But loading a quoted string does. ![]() PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
I can offer you views of the snow on the hills from the kitchen window and crunchy ice on the puddles in the driveway yesterday at 10am. The wife loves the heated seats in the car... Jim VK7JH MMedit |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
Tom, Lizby et al. That does it. "G9.BAS" When I try to RUN I get a message that g9_display.txt will not run. I don't think that is important. I will now tidy up the method, laminate it and nail it to my wall. But thanks to you lot I am well on the way. When English people started migrating here in the 50s, they were told that the average temp. is 25 degrees. They were not told that it is zero for 6 months and 50 for 6 months. Peter(B) |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
I didn't remember having posted g9.bas. What's the date on that? Anyway, here's the latest version of g9_display.txt (zipped because of above CHR$(127) codes, which might not display properly). Coding is Code Page CP-437. MMBasic for Windows will properly print IBM graphics characters in CP-437 coding. g9_display.zip G9.bas will need to be changed to point to wherever you put g9_display.txt. Once unzipped into your directory, this will print the file: OPEN "g9_display.txt" for input as #1 do: line input #1,a$: ?a$: loop until EOF(#1) CLOSE #1 ![]() (Note: this exact code also works in MMBasicDOS.) ~ Edited 2022-07-21 22:43 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
Thanks Lizby 'MMEDIT!!! Basic Version = CMM2 'MMEDIT!!! Port = :10,300 'MMEDIT!!! Device = CMM2 ' =========================================================== ' GEOTHERMAL CONTROL PROGRAM GCP.BAS V1.00g 06/20/2022 ' BY: PAUL LEPKOWSKI & LANCE BENSON And I thought I was nearly there. I have much to do but the oncoming light may not be a train. I have to do the shopping this morning. Peter(B) |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
Tom, Lizby et al. After taking a few days off to do "girly" things I have returned to my problem. I can now flip Pico pins using TeraTerm or MMBASIC. I have yet to read a pin but given my enormous intellect that should only take about 30 years. I got into all sorts of problems particularly with the various versions of MMBASIC. Do you younger blokes experience this? But after all my trials and tribulations I am up and running with a Pico. connected to a WIN 7 or WIN 10 PC. I have yet to try LINUX. Thanks for your help Peter(B) |
||||
pwillard Guru ![]() Joined: 07/06/2022 Location: United StatesPosts: 313 |
Just you... no wait... I have this problem all the time. ;-P |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hi Peter, The subtle differences between MMBasic versions can be rather a nuisance it's true - plus there are so many different betas floating around. The existence of both MMBasic for DOS and MMBasic for Windows (MMB4W) also confuses matters as they are significantly different with MMB4W being part of @matherp's newer MMBasic family. Fortunately TBS is a really helpful group and @matherp is a (somewhat kranky) MMBasic developing machine ![]() Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
Congratulations. That's a good part of the battle. Here's how to read a DS18B20 temperature sensor attached to the PicoMite talking to MMBasic for Windows over serial. (Note--in order to get long lines to work, I set MODE 9 and FONT 1. Any error message changes the font, so if you are fiddling and get errors, you may need to repeatedly set FONT 1.) ![]() The code is: dim string a$,QT=34 ' scratch variable a$ and double-quote dim integer i open "com7:115200" as #1 ' change to suit your COM port print #1, "? "+QT+"! "+QT+"; tempr(10)" ' this says print "!" and temp from pin 10 do: line input #1,a$: if mid$(a$,1,1)="!" then: print "Temperature: ";val(mid$(a$,4,2)): exit: endif: loop a$=input$(255,#1) ' clear the serial buffer close #1 "Temperature: 23" gets printed. Note that I put the "DO" loop all on one line so that it could be typed at the ">" prompt. In a program, you would unroll the DO for legibility and so you could add comments. Reading a pin would be similar. After setting it up with SETPIN, you would do "print #1, "? "+QT+"! "+QT+"; pin(1)" (for instance). I put the PRINT "!" in to make it easier to pick out the line containing the returned temperature reading. I just noticed that you can use VAL(MID$(a$,2)) instead of VAL(MID$(a$,4,2)) and it will ignore leading spaces and give you any decimal places, e.g., 23.75. ~ Edited 2022-07-26 00:26 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
Thanks Lizby etc. I will now get started understanding your code. Peter(B) |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |