Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Support

Pages: 1 ... 26 27 [28] 29 30 ... 59
406
ScriptBasic OPEN of sockets and serial ports do NOT support timeouts. SB will wait forever on a port until it's closed.

I didn't have much hope for serial port support with cURL but it looks like you might have discovered a way. If cURL works for serial ports, that is the best way to go.




407
Try a MODE command to setup your serial port.

The CURL extension module allows connecting to a port with timeout support. (and a bunch of other features) Maybe you can give that a try. SB's socket/serial port support is pretty raw.


408
It's been a long time since I played with serial port communications under Windows. I think you need to setup the port from the OS (bits, speed, parity, ...) before using it in your SB script. You may be able to do this from SB with a SYSTEM command prior to opening the COMM port. You are just going to have to play with it to find out what works. I see no reason to close the port between access runs but this is something you will need to experiment with. Please keep us in the loop with your progress.

You don't have to use LINE INPUT and can use INPUT that doesn't wait for an end of line sequence. You tell INPUT how many characters to get and it will return what you requested or whatever is in the buffer at the time.



409
Quote
What's the syntax for "Select Case"?

Code: [Select]
IF case = 1 THEN
  ' Do case 1 stuff
ELSE IF case = 2 THEN
  ' Do case 2 stuff
ELSE
  ' Do default case stuff
END IF

Sorry, no SELECT/CASE but IF/THEN/ELSE has unlimited nesting.

410
Quote
open "COM1:4800" for comm as 1

Try this.

Code: [Select]
OPEN "COM1:4800" FOR BINARY AS #1

I tried the following with my old laptop running Ubuntu that has an internal modem.

Code: [Select]
OPEN "/dev/ttySL0" FOR BINARY AS #1
PRINT #1,"ATZ\r"
LINE INPUT #1, mr
PRINT mr
LINE INPUT #1, mr
PRINT mr

jrs@laptop:~/sb/test$ scriba testmodem.sb
ATZ
OK
jrs@laptop:~/sb/test$

411
ScriptBasic doesn't support timers like VB so you may have to be a little creative with this. You have a few ways to approach this.

1. You could create a MAIN routine that checks NOW and runs a set of SUBs/FUNCTIONs and SLEEPs when there is nothing to do.

2. Create two scripts. One that polls devices as gets info and write it to a file. The other script would process the file on a first in first out basis.

3. Create an extension module with a true timer and access your device from the extension module.


412
Code: [Select]
Send_Buf[0] = &H2
Send_Buf[1] = &H6
Send_Buf[2] = &H4
Send_Buf[3] = &H1
Send_Buf[4] = &H22
Send_Buf[5] = &H10
Send_Buf[6] = &H0
Send_Buf[7] = &H0
FOR i = 0 TO 6
  Send_Buf[7] = Send_Buf[7] XOR Send_Buf[i]
NEXT

PRINT Send_Buf[7],"\n"

jrs@laptop:~/sb/test$ scriba mytest3.sb
51
jrs@laptop:~/sb/test$

My error, I shouldn't have converted it to a character value first.  :-\

413
IUP / Re: IUP Linux and Windows
« on: October 18, 2012, 06:47:14 PM »
I now have Windows 7 64 bit installed and will be picking back up with the IUP project on both Windows and Linux platforms in 64 bit only.

Stay Tuned!

414
Code: [Select]
Send_Buf[0] = CHR(&H2)
Send_Buf[1] = CHR(&H6)
Send_Buf[2] = CHR(&H4)
Send_Buf[3] = CHR(&H1)
Send_Buf[4] = CHR(&H22)
Send_Buf[5] = CHR(&H10)
Send_Buf[6] = CHR(&H0)
Send_Buf[7] = CHR(&H0)
FOR i = 0 TO 6
  Send_Buf[7] = Send_Buf[7] XOR Send_Buf[i]
NEXT

PRINT ASC(Send_Buf[7]),"\n"

jrs@laptop:~/sb/test$ scriba mytest2.sb
48
jrs@laptop:~/sb/test$

Does your VB code return the same value as above?

The rest is simply opening up a socket and using PRINT and INPUT to communicate with the device.


415
Glad to hear you're able to move on with your project.

Someday I plan to add array sort to the T extension module. (the plate is a bit full at the moment)

416
Code: [Select]
' Packing a integer

np = PACK("I2",12345)

PRINT np,"\n"

UNPACK np BY "I2" TO n

PRINT n,"\n"

' Storing an array in a string

IMPORT t.bas

a[0] = "JRS"
a[1] = 2012

s = t::ArrayToString(a)

t::StringToArray(l,s)

PRINT l[0],"\n"
PRINT l[1],"\n"

jrs@laptop:~/sb/test$ scriba mytest.sb
90
12345
JRS
2012
jrs@laptop:~/sb/test$


Works fine for me. You were trying to PACK a number with a string type.

Hope this helps.

417
What's New / Re: C for Android
« on: September 20, 2012, 08:24:37 AM »
It gives gives Android Linux developers a more traditional approach towards application development rather than just creating Java based Play store attractions at  .99 cents a copy.


418
What's New / Re: C for Android
« on: September 18, 2012, 09:34:24 PM »
I thought I would post an update on my adventures of creating native C/C++ Android Linux applications. The following screen shots were compiled native on my Samsung Galaxy Tab 2 10.1 tablet.

Qt







SDL


419
Round Table / New Amazon Fire HD
« on: September 07, 2012, 09:29:13 AM »
Quote
Crippled Android

My biggest complaint about the Kindle Fire line is it's Android...under the hood. But you can't get under the hood without jail breaking the device. Android is so limited on these devices they shouldn't be allowed to call it Android. It should be called Kindroid. Android is entirely crippled on the Fire. If you are accustomed to a standard Android OS you will be disappointed with the functionality of the Fire version of Android.

Sounds like a challenge to me.  8)



The other side of the story

420
Round Table / Re: Samsung vs. Apple
« on: August 29, 2012, 09:47:22 AM »
Samsung and Google need a new dress

Quote from: Jason Perlow-ZDNet
In plain English: It could be that Apple mobile device industrial design and user interface is the only kind that consumers really want.

I hope he is wrong, but he may be right. And if that's the case, there isn't a dress that Samsung or Google can put on Android devices that will make them look pretty in the eyes of the smartphone and tablet-buying public.


Pages: 1 ... 26 27 [28] 29 30 ... 59