Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : "Input" command cause trouble
Author | Message | ||||
Hansaplast Newbie Joined: 13/07/2023 Location: Hong KongPosts: 10 |
Is there is any mistake by me (PICOMITE)? Try this: PRINT "Input Power ON Time (HHMMSS): " INPUT a$ PowerOn = VAL(a$) : PAUSE 50 PRINT PowerOn PRINT "Input Power OFF Time (HHMMSS): " INPUT b$ PowerOff = VAL(b$) : pause 50 PRINT PowerOff ...and you will see that after the 1st. "Input" command input the software will jump over the 2nd. "Input" command line without any input. > RUN Input Power ON Time (HHMMSS): ? 150000 150000 Input Power OFF Time (HHMMSS): ? 0 What I did wrong???? Edited 2023-12-15 13:55 by Hansaplast |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
Works for me. Others have mentioned that sometimes there is a need to clear the keyboard buffer of stray characters. Search for that. WEB A:/> list Print "Input Power ON Time (HHMMSS): " Input a$ PowerOn = Val(a$) : Pause 50 Print PowerOn Print "Input Power Off Time (HHMMSS): " Input b$ PowerOff = Val(b$) : Pause 50 Print PowerOff Sub mm.prompt Print "WEB "Cwd$"> "; End Sub End WEB A:/> run Input Power ON Time (HHMMSS): ? 123456 123456 Input Power Off Time (HHMMSS): ? 234567 234567 WEB A:/> |
||||
Hansaplast Newbie Joined: 13/07/2023 Location: Hong KongPosts: 10 |
Under Basic it should be PRINT "Input Power ON Time (HHMMSS): " LINE INPUT a$ PowerOn = VAL(a$) PRINT PowerOn PRINT "Input Power OFF Time (HHMMSS): " LINE INPUT b$ PowerOff = VAL(b$) PRINT PowerOff Same program in QB64 work fine ! So for me it's a PicoMite BUG Rem: Input is via USB |
||||
Hansaplast Newbie Joined: 13/07/2023 Location: Hong KongPosts: 10 |
|
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
It sounds like you have the end of line in your terminal program set to CRLF Try changing that to LF The first end-of-line character gets used up for the first input then the second end-of-line character is seen by the second INPUT command, hence the empty result. Not a bug. Jim VK7JH MMedit MMBasic Help |
||||
Hansaplast Newbie Joined: 13/07/2023 Location: Hong KongPosts: 10 |
I use MM Edit as test platform and the MM Chat |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
Adding this before the second input may help if you don't want to change the terminal settings. do : loop until inkey$ = "" |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
I suggest you update MMEdit to the latest version. Then you will be able to set the end-of-line characters VK7JH MMedit MMBasic Help |
||||
Hansaplast Newbie Joined: 13/07/2023 Location: Hong KongPosts: 10 |
Example from Geoff's PicoMite Manual, Page 22: For example: OPEN "numbers.txt" FOR INPUT AS #1 LINE INPUT #1, a$ LINE INPUT #1, b$ CLOSE #1 x = VAL(a$) : y = VAL(b$) Following this the variable x would have the value 123 and y the value 56789. Modified: LINE INPUT a$ LINE INPUT b$ x = VAL(a$) : y = VAL(b$) PRINT x,y The result: > RUN 123456 0 123456 > It's a BUG ! |
||||
Hansaplast Newbie Joined: 13/07/2023 Location: Hong KongPosts: 10 |
in the Picomite Version MMBasic Ver 5.07.07 |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
As Jim said there is no bug. At the MMEdit end CRLF is being sent but only CR is needed. the LF character becomes the second input. I have just tested your program again with the terminal line endings set to CRLF and it produces your symptoms. Adding the line in my previous post fixes it, as does changing back to CR only. Print "Input Power ON Time (HHMMSS): " Input a$ PowerOn = Val(a$) : Pause 50 Print PowerOn Do : Loop Until Inkey$ = "" Print "Input Power Off Time (HHMMSS): " Input b$ PowerOff = Val(b$) : Pause 50 Print PowerOff Edited 2023-12-15 15:13 by phil99 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
The BUG is in the old version of MMEdit that you are running. Later versions let you easily change the end-of-line. Then you can see the differences. VK7JH MMedit MMBasic Help |
||||
amigawizard Regular Member Joined: 15/08/2023 Location: AustraliaPosts: 43 |
works for Me 2 ! LINE INPUT a$ LINE INPUT b$ x = VAL(a$) : y = VAL(b$) PRINT x,y on the command line using minicom or telnet on Putty no BUG ! here .. Wayne ! ` |
||||
Print this page |