I would like to contribute something; of the past 7 months using the library (gtRS232free7.nbp), I could do some things, like the communication of NB-Arduino by USB cable, via BlueTooth, USB control via cart, use of shield-ethernet / internet via NB, from MySitio.com, make NB send commands to Arduino and the reverse, and more. I leave it to your attention this example, the first thing I did in Feb / 2014. A PUB and INO, the latter ran the Arduino Uno and Mega -2560. I must say that my first attempt was using "vbs" and BasicLiberty a program to read the serial port and the data passing through "clipboard." If there's interest in these just ask me. Thanks for reading.
PUB
Code: Select all
NBW Publication Source File
(C)2014 NeoSoft Corp.
Title=Ejemplo Arduino
Author=GdoSan-Feb/2014
Language=US
NeoBookVer=5.80
ScreenColors=16777216
ScreenWidth=640
ScreenHeight=480
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=29
BiDiMode=0
AllowESC=No
AllowPageUpDn=No
UseUpdateTimer=Yes
ReturnTime=60
StartupAction=if "[NbMode]" "=" "D"¶ ObjectToFront "RcTapa"¶ ObjectToFront "Gr"¶ moveobject "BtPause" "250" "20"¶ hideobject "BtPause" "" ""¶endif
ShutdownAction=gtCommClose "[Prt]"
ShapeTransColor=536870912
SplashProps=3
CompressPub=Yes
CompiledName=ArduinoNeobook.exe
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
FontsToCompile=|
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
ReqExLevel=1
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=Main
PageStyle=0
PageColor=10262272
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
EffectSpeed=0
PgEnterAction=setvar "[Prt]" "3"
ObjectType=8
Name=InfColor
X=75
Y=-80
W=60
H=15
Anchor=0
Font=Arial
FontSize=9
FontStyle=1
FontCharset=1
TextColor=16777215
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\qc\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0\b 0,151,156}}¶}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=10262272
FillPattern=0
TabOrder=4
ObjectType=15
Name=Tm
X=609
Y=2
W=32
H=32
Anchor=0
AutoStart=No
Interval=1000
ObjAction=gtCommRxS "[Prt],numbytes,ret"¶.gtCommRx "[Prt]"
ObjectType=5
Name=RcTapa
X=39
Y=11
W=320
H=122
Anchor=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=10262272
FillPattern=0
TabOrder=12
ObjectType=3
Name=BtEnviar
X=161
Y=62
W=55
H=30
Anchor=0
Text=Enviar
Align=2
Key=13
ImageStyle=0
XPTheme=Yes
ObjAction=TimerStop "Tm"¶HideObject "EntRet" "None" "0"¶¶gtCommSend "[Prt],[enviar]"¶¶.gtCommRxS "[Prt],1,return"¶.gtCommRxFlush "[Prt]"¶.Delay "10"¶TimerStart "Tm" "[Retardo]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=9
Name=EntEnviar
X=44
Y=62
W=113
H=30
Anchor=0
Text=123~
VarName=[enviar]
Align=1
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
FillMode=Yes
Font=Arial
FontSize=14
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=3
Name=BtRecibir
X=250
Y=20
W=55
H=30
Anchor=0
Text=Recibir
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=setvar "[byte]" ""¶setvar "[buff]" ""¶setvar "[retrx]" ""¶setvar "[numbytes]" ""¶setvar "[Retardo]" "200"¶. CREO LEE DE 1 EN 1 BYTE¶.gtCommRxByte 'port,¶. byte,¶. buff'¶. Receive data from an¶. open comm port¶.--gtCommRxByte "[Prt],byte,buff"¶.--gtCommRxFlush "[Prt]"¶¶¶.gtCommRxS (port,return var name,number of bytes)¶..gtCommRxS "[Prt],numbytes,ret"¶ShowObject "EntRet" "None" "0"¶timerstart "Tm" "[Retardo]"¶ShowObject "BtPause" "None" "0"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=6
ObjectType=3
Name=BtArduFast
X=312
Y=20
W=40
H=20
Anchor=0
Text=Fast
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=TimerStop "Tm"¶math "[Retardo]-50" "" "[Retardo]"¶delay "25"¶TimerStart "Tm" "[Retardo]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=11
ObjectType=3
Name=BtArduSlow
X=312
Y=63
W=40
H=20
Anchor=0
Text=Slow
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=TimerStop "Tm"¶math "[Retardo]+50" "" "[Retardo]"¶delay "25"¶TimerStart "Tm" "[Retardo]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=8
ObjectType=8
Name=InfRetardo
X=312
Y=40
W=40
H=20
Anchor=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\qc\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 [Retardo]}}¶}
HMargin=0
VMargin=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
TabOrder=10
ObjectType=9
Name=EntRet
X=44
Y=94
W=200
H=30
Anchor=0
VarName=[Ret]
Align=1
WordWrap=No
ScrollBar=No
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=10262272
FillPattern=0
Font=Arial
FontSize=14
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=13
ObjectType=3
Name=BtPause
X=188
Y=20
W=55
H=30
Anchor=0
Text=Pause
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=timerstop "Tm"¶HideObject "BtPause" "None" "0"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=1
ObjectType=20
Name=Gr
X=49
Y=25
W=132
H=31
Anchor=0
TabOrder=14
GroupBegin
ObjectType=3
Name=BtClosePort
X=31
Y=0
W=100
H=30
Anchor=0
Text=Cerrar Puerto
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=gtCommClose "[Prt]"¶showobject "BtOpenPort" "" ""¶EnableObject "EnPort"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=0
ObjectType=3
Name=BtOpenPort
X=32
Y=1
W=100
H=30
Anchor=0
Text=Abrir Puerto
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=gtCommOpenStd "[Prt],9600"¶HideObject "BtOpenPort" "None" "0"¶HideObject "RcTapa" "None" "0"¶DisableObject "EnPort"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=1
ObjectType=9
Name=EnPort
X=0
Y=0
W=28
H=30
Anchor=0
VarName=[Prt]
Align=1
EditNumber=Yes
EditLen=1
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=14
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
GroupEnd
ObjectType=8
Name=InfHelp
X=-241
Y=-334
W=300
H=277
Anchor=0
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtComms V7.01 PlugIn G Turner\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 (RS232 Communications Plugin for NeoBook)\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtOpenCommErr\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommErr\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRIT\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRTTM\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRTTC\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommWTTM\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommWTTC\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommEof\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTcpErr\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTcpEof\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 ABC123\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 Open-Close\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommOpen\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommOpen (port,baud,bits,parity,stop,txbuffer,rxbuffer)\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommOpenStd\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommOpenStd (port,baud) \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab A simpler way to open a port using default values (See the help file)\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommClose\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommClose (port) Closes an open comm port\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 Port Settings\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSetBaud\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSetBaud 'port,baud' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Change baud rate on an open comm port\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSetTxBuffer\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSetTxBuffer 'port,buffer' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Change TX buffer on an open comm port\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSetRxBuffer\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSetRxBuffer 'port,buffer' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Change RX buffer on an open comm port\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 Transmit data\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSend\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSend 'port,data' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Send data to an open comm port\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSendCRLF\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommSendCRLF 'port,data' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Send data to an open comm port with a CR & LF\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 Receive data\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRxByte\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRxByte 'port,byte,buff' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Receive data from an open comm port\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRxS\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRxS (port,return var name,number of bytes)\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRx\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRx 'port,filename,bytecountvar' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Write RX buffer to file\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRx\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRxLine\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRxLine 'port,var,timeout (mS*10)'\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRxFlush\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRx 'port' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Flush RX Buffer\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 Port Information\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRxCount\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommRxCount 'port,num bytes' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Get count of bytes in the RX buffer\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommGetBaud\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommGetBaud 'port,baud var' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Get the current baud rate for the specified port\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 Flow Control\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommXonXoff\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtCommXoXoff 'port,setting' \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 \tab Set software flow control. 1=On, 0=Off\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 TCP Client Comms\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPopen\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPopen 'host,port,timeout'\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPclose\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPclose ''\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPsend\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPsend 'data to send'\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPsendCRLF\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPrxbyte\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPrxbyte 'var to store byte'\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPrxline\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPrxline 'var to store line'\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPrxF\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPrxF ''\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPrxFT\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPrxFT '' with timeout\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 gtTCPrxFlush\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs18\cf0 Flush any waiting bytes}}¶}
HMargin=4
VMargin=4
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
TabOrder=15
ObjectType=8
Name=InfDebug
X=375
Y=12
W=230
H=65
Anchor=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 gtOpenCommErr: [gtOpenCommErr]\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 gtCommErr: [gtCommErr]\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 gtCommEof: [gtCommEof]}}¶}
HMargin=4
VMargin=4
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
TabOrder=16
ObjectType=3
Name=BtQuit
X=288
Y=99
W=50
H=27
Anchor=0
Text=Quit
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=TimerStop "Tm"¶gtCommRxFlush "[Prt]"¶Exit "" ""
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=7
ObjectType=15
Name=TmLinea
X=97
Y=195
W=32
H=32
Anchor=0
AutoStart=No
Interval=1000
ObjAction=.setvar "[mS]" "1"¶gtCommRxLine "[Prt],data,timeout(mS*10)"
ObjectType=3
Name=BtIniTimer
X=38
Y=160
W=96
H=35
Anchor=0
Text=([Data])
Align=1
ImageStyle=0
XPTheme=Yes
ObjAction=TimerStart "TmLinea" "100"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=17
ObjectType=3
Name=BtTimerStop
X=141
Y=160
W=40
H=35
Anchor=0
Text=[mS]
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=TimerStop "TmLinea"¶math "[mS]+2" "" "[mS]"¶TimerStart "TmLinea" "100"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=20
ObjectType=3
Name=BtLeeArduinoData
X=224
Y=166
W=160
H=35
Anchor=0
Text=gtCommRxF
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=..GUARDA LOS DATOS QUE VIENEN DEL ARDUINO¶setvar "[FileName1]" "[PubDir]SacaData1.txt"¶setvar "[FileName2]" "[PubDir]SacaData2.txt"¶¶setvar "[ByteCountVar1]" "1"¶setvar "[ByteCountVar2]" "2"¶¶..Probar con # valor¶gtCommRx "[Prt],[FileName1],[ByteCountVar1]"¶delay "500"¶gtCommRxF "[Prt],[FileName2],[ByteCountVar2]"¶¶fileread "[PubDir]SacaData1.txt" "All" "[TxData1]"¶fileread "[PubDir]SacaData2.txt" "All" "[TxData2]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=18
ObjectType=9
Name=EnData1
X=208
Y=208
W=90
H=190
Anchor=0
VarName=[TxData1]
Align=1
EditMultiLine=Yes
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=22
ObjectType=9
Name=EnData2
X=315
Y=208
W=90
H=190
Anchor=0
VarName=[TxData2]
Align=1
EditMultiLine=Yes
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=21
ObjectType=8
Name=Text15
X=455
Y=117
W=176
H=145
Anchor=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs24\cf0 [ret]}}¶}
HMargin=4
VMargin=4
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
TabOrder=23
ObjectType=3
Name=BtEnvRec
X=456
Y=266
W=78
H=30
Anchor=0
Text=Env/Rec
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=TimerStop "TmLinea"¶¶TimerStop "Tm"¶HideObject "EntRet" "None" "0"¶gtCommSend "[Prt],[enviar]"¶delay "50"¶setvar "[byte]" ""¶setvar "[buff]" ""¶setvar "[retrx]" ""¶setvar "[numbytes]" ""¶setvar "[Retardo]" "200"¶¶ShowObject "EntRet" "None" "0"¶timerstart "Tm" "[Retardo]"¶ShowObject "BtPause" "None" "0"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=5
Code: Select all
// ArduNeo.ino
// SE PEGA CON EL "ARDUINO1.PUB"
int Led = 13;
int Lento = 100;
int Data = 0;
String sg = "S";
char byt ;
String StrEntra = "";
boolean StrListo = false;
void setup() {
StrEntra.reserve(200);
Serial.begin(9600);
pinMode(Led, OUTPUT);
digitalWrite(Led, HIGH);
Serial.println("POTENCIOMETRO");
Serial.println( "~" + String(Lento) + "~");
delay(2000);
Inicio( 0 );
Serial.println("--- REGRESO ---");
}
void loop() {
digitalWrite(Led, HIGH);
delay(Lento);
Serial.println( Data );
digitalWrite(Led, LOW);
delay(Lento);
if ( sg == "S" )
{
Data += 64;
if (Data >= 1024) {
sg = "R"; // Resta
}
}
else
{
Data -= 64;
if (Data <= 0) {
sg = "S"; // Suma
}
}
if (Serial.available() > 0) {
byt = Serial.read();
if ( byt == 65 || byt == 97) // Aa
{
StrListo = false;
xserialEvent();
}
if ( byt == 83 || byt == 115) // Ss
{
Serial.println("ALTO");
Inicio( 0 );
Serial.println("...REGRESO...");
return;
}
}
}
void Inicio(int flg ) {
Serial.flush() ;
Serial.print("Le llevo [");
Serial.print(Serial.available());
Serial.println("]");
while (Serial.available() <= 1 ) {
digitalWrite(Led, HIGH);
delay(50);
digitalWrite(Led, LOW);
delay(50);
}
byt = Serial.read();
Serial.print("Recibio: (");
Serial.print(byt);
Serial.println(")");
if ( byt == 65 )
{
xserialEvent();
Serial.println("YA VINE");
}
digitalWrite(Led, LOW);
delay(2000);
return ;
}
void xserialEvent() {
while (Serial.available()) {
char ChrEntro = (char)Serial.read();
if (ChrEntro == 48 ) {
Serial.println("TONCES: " + StrEntra);
digitalWrite(Led, HIGH);
delay(2000);
StrListo = true;
}
StrEntra += ChrEntro;
}
}
SOMOS PURA VIDA