Weekly Qbasic and Qb64 Lesson Topics
April 06, 2020, 04:48:52 pm
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
   Home   Help Search Arcade Links Staff List Login Register  

Pages: [1] 2 3 ... 10
 1 
 on: February 20, 2020, 12:36:19 am 
Started by kanga85 - Last post by kanga85
I formerly printed in QB64 to LPT1, but now I have a USB printer.   This claims to to be at USB001, but I cannot find the correct code to print to it.   Open "O", #1, LPT1 used to work, but now Open "O", #1, USB001 fails to send anything to the USB printer.    What code should I use?   
Thanks for any help

 2 
 on: February 14, 2020, 05:16:47 am 
Started by kanga85 - Last post by kanga85
In a QB64 program I have the line:
Open "O:, #1, "LPT1:"
used to print to an old HP LaserJet connected through a printer port.   
The Laser Jet has now collapsed and I now have a newer printer (Brother HL 2130) connected through a USB port.
What code do I now need to 'Open' the line to the USB printer.
Thanks for any help.

p.s.  This is an old program, first written in Basic in 1975 for a Hitachi Peach, subsequently changed for Windows, XP, through to Windows 10, and now compiled in QB64.

 3 
 on: June 18, 2018, 08:05:58 am 
Started by parsec - Last post by parsec
Hi,
I have a problem rounding numbers: why

PRINT CLNG(90.7755 * 1000) / 1000 = 90.776

and instead

PRINT CLNG(90.7754 * 1000) / 1000 = 90.77500000000001?

I'm becoming crazy!
Thanks a lot!!

fabio


 4 
 on: June 17, 2018, 10:55:59 am 
Started by parsec - Last post by parsec
Hello!
I live in the wonderful Italy and my English is very terrible, but now I can use the web to have assistance, not like when I started using basic program, when dinosaurs wandered around... Sad
If someone want to correct my English texts is welcome! ...In exchange I could teach how to cook a very tasty spaghetti!! Cheesy Cheesy
So, I came in this forum to have some answer about this program since I didn't used it since dozens years ago...

Fabio

 5 
 on: January 12, 2018, 06:42:18 am 
Started by PhilAJ - Last post by PhilAJ
Hope someone can help me - I have a little QB64 program that loads a website - passing details from the command line. This works fine - BUT - it leaves the command window open.

Anybody know how I can close this automatically once the web page loaded.

My code is; (actual webpage changed)

SHELL "http://www.bbc.co.uk"

I have tried using _HIDE and _SHELLHIDE but don't seem to work.

ANy help appreciated.

Phil

 6 
 on: January 03, 2018, 11:29:36 am 
Started by Luke - Last post by Luke
I discovered a QB64 work around for the Fundamental Problem. just above the Z$=input (LOC(2),#2) statement i added line ON ERROR GOTO EHandler. Then at the end of the program I put
EHandler: 
errfile$ = _INCLERRORFILE$
RESUME NEXT

I used LOC for length of input record b/c LOF always =0. The EOF=-1 always generates an INPUT PAST END OF FILE error. This way the program steps over the error and continues.
It may not be the best way but it works for me.
As for the every other letter read. I jury rigged the output message of the A/D with spaces to output the characters in the position captured by the input command. Weird but it works and I am continuing with my project not really understanding why it's that way.

 7 
 on: December 18, 2017, 03:06:58 pm 
Started by Luke - Last post by Luke
When one opens a com port to read a serial data buffer the open command automatically sets the EOF, LOC, and LOF to no message state.
I.E. the statement OPEN "COM3: 9600,n,8,1" for INPUT AS #1 will set EOF=-1. When attempt is made to obtain data from the com buffer with the INPUT statement you get an INPUT PAST END error because EOF=-1.
When you open the com port with the FOR RANDOM option then an attempt to obtain data with a GET statement you get a BAD RECORD LENGTH error due to LOF=0.
I have yet to find a way around this problem.

I have an A/D converter connected to a 1.2 V battery that has placed the message:   Voltage = 1.2* in the buffer. If I open FOR INPUT and upon the INPUT PAST END OF FILE error a DO YOU WANT TO CONTINUE dialog box appears. IF I select YES I get Vlae=12. That is every other character in the buffer. I altered the A/D output spacing to shift things by one space at the beginning and I get otg.2* . I.E the missing letters. Although not correct by any means it gives me confidence that the correct message is sitting in the buffer. I just can't read it because of the above defined problem.
Has anyone else encountered this problem? Is it due to my particular version compiler? Is there a "work around?"

I discovered a QB64 work around for the Fundamental Problem. just above the Z$=input (LOC(2),#2) statement i added line ON ERROR GOTO EHandler. Then at the end of the program I put
EHandler: 
errfile$ = _INCLERRORFILE$
RESUME NEXT

I used LOC for length of input record b/c LOF always =0. The EOF=-1 always generates an INPUT PAST END OF FILE error. This way the program steps over the error and continues.
It may not be the best way but it works for me.








 8 
 on: December 13, 2017, 06:26:41 pm 
Started by Luke - Last post by Luke
I am getting "bad record length" error at the GET #1, ,m$ statement in the following QB64 code. I can't seem to find exactly how I should go about reading the message posted in the com port buffer by Arduino when all I asked for is A/D voltage on analog pin 4.
Any Ideas?
OPEN "Com3:9600,n,8,1,ds0,cs0,rs" FOR RANDOM AS #1
_DELAY .5 '                                       Delay to let Com Port settle
FIELD #1, 50 AS m$

t1 = TIMER '                                     Start time for getdata

getdata:
bytes% = LOC(1) '                             Check receive buffer for data
IF bytes% = 0 THEN GOTO getdata '         After thousands of getdata cycles it continues
PRINT "Bytes="; bytes '                            Bytes remain at 0
DO UNTIL EOF(1)
    GET #1, , m$ '                             BAD RECORD LENGTH ERROR
    PRINT "LEN(m$)= "; LEN(m$) '               Length of m$ = 10
    IF INSTR(m$, "*") > 0 THEN GOTO duh '    Never finds End of Message (*)
LOOP

IF bytes% = 0 THEN GOTO getdata
t2 = TIMER '                                         End time, Have data
DeltaT = t2 - t1 '                                   How long did it take?
GOTO stepover

duh:
PRINT "DUH instr= "; INSTR(m$, "*") '               Never hits this line
stepover:

tmp$ = "DeltaT= #.### Seconds Until LOC(1) > 0" '    Various times arround 0.66 Sec
PRINT USING tmp$; DeltaT
PRINT "m$ Received= "; m$ + "&" '                 Prints 10 spaces No Data
PRINT "endofdata= "; endofdata '                  endofdata=0, Never got "*"
PRINT "ctr= "; ctr, CHR$(13) '            Show number of times you pressed continue
CLOSE #1

Arduino Code sending info is the following:

 if ( cmd == 2)//getanalog
   {
        int sensorValue = analogRead(pin);//
        delay(10);
        float voltage= sensorValue*(5.0/1023.0);
        Serial.print("Voltage =");
        Serial.print(voltage);
        Serial.print(",");
        Serial.print("*");

The asterisk should be in the buffer indicating the end of my message.
 

 9 
 on: August 30, 2017, 10:22:34 am 
Started by QB513 - Last post by Dimster
I am new to this website, please consider this reply as me just exploring the site and trying out things to do. I'm sure QB513 has figured out this problem or abandoned coding altogether by now. If QB513 is familiar with Arrays and the Dim function, one way the problem could be solved is to dimension an array to hold each day's pay - so Dim Pay(30). You would then create a for/next loop . for P = 1 to 30. Within the loop you will need a line of code to do the math, ie take a the last day's pay and double it. Then store that value in Pay(P). (Note:Whatever variable you are using for the "last day's pay" should be made equal to "0" before the for/next loop. After the looping has ended you will need another for/next loop to calculate the total of all the values stored in Pay(30). As for the Printed Report, Yash has given a very good hint. The "?" is a shorter way to code the command word "Print" and the use of "Locate" for your columns and rows is the way to go. You simple need to print what you have stored in your Arrays and the Variable you have storing the total amount paid.

Seems there is quite a bid of room for these replies. The Preview shows only one line at a time but that's cool, it does pick up the Bolding and Italic and color.

 10 
 on: August 29, 2017, 03:08:33 pm 
Started by Dimster - Last post by Dimster
Trying to code a drop down menu in QB64. I am new to QB64 and understand the concept of drawing a line/box, erase and redraw I'm lost on coordinating the color fill of the box with the menu items that i want to appear in the various drop down boxes. Are there some sample codes in some of the QB64 commands that i could read up on and play with or some site/book that may give me some ideas on Drop Down Menu's. Thanks

Pages: [1] 2 3 ... 10
Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy