mmiscool
Full Member
Send me a message if you want to help with a WEB OS project
Posts: 106
|
Post by mmiscool on Mar 29, 2015 16:35:25 GMT -5
Hello,
I recently started working on an LB interface for the arduino to do simple pin I/O.
Looking to see if there is any interest in making a set of functions similar for run basic for in I/O.
They will probably be the same exact functions. Just modified to use the helper program in LB.
It would take advantage of the shell$() command an require a LB program to be placed in the RB101 directory.
IF there is any interest let me know so I can start working on it and get a zip file out there.
|
|
|
Post by meerkat on Mar 30, 2015 9:08:09 GMT -5
Yes.. I was working on a Avionics system. I was using another interface board that worked great. The board is no longer available, so I bought a arduino board and was going to start working on it when I got back to the project. The arduino interface I was going to build would have the following interface. I'd send it a command to do something and it would respond with the request. The command would tell it how many readings to send back. For example when reading some Analog reading they may vary from reading to reading because of electrical and the nature of the devide. So for example I may ask for the gas level on Analog point 3 with 5 readings. When I get the 5 readings I toss the High and Low reading and average the 3 remaining readings. All the data sent from arduino would be followed with a carriage return<cr>. That way if I was using LB, I could use the simple input statement. However right now because of the limitations of LB I was going to use REBOL. But for this I could use LB. My request may be something like: 1. R - Read or W write 2. A or D.. For Analog or Dightal 3. Pin.. The pin number 4. Number of readings. So R,A,3,5 would mean to read analog pin 3 with 5 readings. W,D,1,0 would set digital pin 1 to 0 For R,A,3,5 The response back would be 1111,2222,3333,4444,5555<cr> If I get time I'll write the arduino interface and post it. However right now I'm committed to another project, and it may take me a few weeks to get to it.. I do have a little information on the Avionics system here: kneware.com/avionics/
|
|
mmiscool
Full Member
Send me a message if you want to help with a WEB OS project
Posts: 106
|
Post by mmiscool on Mar 30, 2015 15:47:08 GMT -5
I was working on this a bit.
Made 4 functions in all that the user needs to know about and 1 additional function to handle the actual taking with the arduino. The helper EXE made in liberty basic will take care of all of the interfacing with the arduino. I have a fairly simple sketch that can be uploaded to the arduino and can interface with the functions listed below.
function AD.Set(com.port, PinNo, value) 'Set an Arduino pin high or low, 'Will return 1 one if successful, 0 if not function AD.Get(com.port, PinNo) 'Will return the current state of the input pin '1 for high, 0 for low function AD.PWM.Out(com.port, PinNo, value) 'Set the PWM output on the select pin to the value 'Will return a 1 for success and 0 for failure.
function AD.PWM.In(com.port, PinNo) 'Get the PWM input from the pin 'Will return a value of 0 to 1023
|
|
|
Post by meerkat on Mar 30, 2015 17:04:31 GMT -5
Thanks mmiscool
Are the scripts available somewhere to download or cut and paste. Soon as I get some time, I'd like to try them out..
|
|
mmiscool
Full Member
Send me a message if you want to help with a WEB OS project
Posts: 106
|
Post by mmiscool on Mar 30, 2015 18:02:50 GMT -5
Will be posting a package soon with functions and helper exe file.
|
|
mmiscool
Full Member
Send me a message if you want to help with a WEB OS project
Posts: 106
|
Post by mmiscool on Apr 4, 2015 13:33:08 GMT -5
Hello, I am posting a package with the LB code and helper program. You must copy the program and dll files in to the RB directory and it only works on windows. c:\rb101\RBarduino.exe for example. download at sites.google.com/a/smbisoft.com/www/fun-projects-don-t-look/file/LB_Arduino_Tool.zipThe sketch for the arduino is also included in the package for download above To use this in your own code look at the example below. I will be adding some for error catching and what not to this but for now it is working and has my led blinking.
'The following code will turn on the arduinos on board LED print AD.Set(3,13,1)
'Give the user a chance to see the LED is on input junk$
'Turn the LED off print AD.Set(3,13,0)
end
'Begin Arduino Code here ------------------------------------------------------- 'These functions can be added to any program to provide arduini power input and output 'Descriptions for functions are in there comments
function AD.Set(com.port, PinNo, value) 'Set an Arduino pin high or low, 'Will return 1 one if successful, 0 if not AD.Set = val(AD.talk.to.device$(com.port,"set ";PinNo;" ";value)) end function function AD.Get(com.port, PinNo) 'Will return the current state of the input pin '1 for high, 0 for low AD.Get = val(AD.talk.to.device$(com.port,"get ";PinNo)) end function function AD.PWM.Out(com.port, PinNo, value) 'Set the PWM output on the select pin to the value 'Will return a 1 for success and 0 for failure. AD.PWM.Out = val(AD.talk.to.device$(com.port,"pwm.out ";PinNo;" ";value)) end function function AD.PWM.In(com.port, PinNo) 'Get the PWM input from the pin 'Will return a value of 0 to 1023 AD.PWM.In = val(AD.talk.to.device$(com.port,"pwm.in ";PinNo)) end function Function AD.talk.to.device$(port,msg$) 'Send a Message to the arduino and return the result sent back by the device print shell$("Taskkill /IM RBarduino.exe /F" print shell$("RBarduino.exe ";port;" ";msg$) print shell$("ping 1.1.1.1 -n 1 -w 3000 > nul") open "arduino.response" for input as #mike input #mike, AD.talk.to.device$ close #mike
End function
|
|
|
Post by meerkat on Apr 6, 2015 4:25:40 GMT -5
Thanks mmscool, I'm a little busy now but will certainly give your routines a try.
Currently I'm using the arduino to interface aircraft information such as gas levels and flow rates, engine temperature, oil pressure, flaps up/down. I'm using RFO-BASIC on Android. That's because I also have access to GPS, and level. This gives me the speed and orientation of the aircraft. I'm connected to arduion with bluetooth. That way I can use the tablet for normal use and when I get close to the aircraft it automatically acquires the arduino through bluetooth. I use voice commands and voice response. So if for example if the gas is low, the voice response tells the pilot that the gas is low. All the stuff is displayed on a panel for the pilot. The airport information is done with downloads of map information.
So I will see if Run Basic and LB and handle the same stuff.
Thanks again for the info. Dan
|
|