Show Posts
|
|
Pages: [1] 2 3
|
|
2
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: August 19, 2012, 12:20:40 am
|
hello majdi_mohammad, i just want your help on doing that below..i find hard to do this in vb because i there are many textboxes.. Create a new project and use the code below you need a put a label called (label1)and caption it "Com Port Number. add a communication object named (MSComm1). Put in a text box called (ComPort). Add another longer text box called (text1). add a command button called (Command1)change the caption to "find com port". now add another text box called (text1). Next add a shape object called (Shape1) compile and run the code. Put the number of the com port into the text box called ComPort... just type in "1". click the command button and the other text box should show the pressure and the shape object should change colors.
Thanks!
|
|
|
|
|
3
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: August 18, 2012, 10:03:57 pm
|
hello, it's been a long time..by the way, i try your code for the arduino but when i use to compile this, there is an error occur in this code: pinMode(kaki, INPUT)
which means invalid conversion from int* to 'unit8_t'..what does it mean?.. i used the arduino version 0021 ..thanks for keeping in touch.. 
|
|
|
|
|
4
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: June 26, 2012, 09:08:29 am
|
thank you so much for your reply majdi_mohammad..  i'll try this when the time i come home... but before anything else, this code you posted the inputs are 8 supposedly it's only 4 because the other 4 are just an indicator of the first 4 if it works ( base on the arduino only)..well, again i'll try this.. 
|
|
|
|
|
5
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: June 20, 2012, 12:13:21 am
|
thanks RPCOyle.. ;)i know i'm so makulit..but please am asking you to stay on touch on resolving this just for today and tomorrow..  ..regarding on what you've posted i made it already and yet it works but what i wanted to happen is, the input should be done from the arduino going to the vb application..it seems, when i press the switch button from my hardware which is connected to the arduino i can see on the serial monitor the "<G>" then the "<G>" should be sent to the vb application..inshort, there is no more pressing the button that may happen to the vb and no more command button should be added, all the vb should do is receiving the input from arduino.. anybody please help me..
|
|
|
|
|
6
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: June 19, 2012, 02:28:11 am
|
thanks for replying RPCoyle i'll be online in this consecutive days it's a big opportunity for me to keep in touch with this forum. now, regarding on what you've posted..i just need to clarify this Create a new project and use the code below you need a put a label called (label1)and caption it "Com Port Number.
> base on what i understood...i change the caption on the label as 1 add a communication object named (MSComm1). Put in a text box called (ComPort).
> do i have to put a textbox on my form then if it is..i change the text into ComPortAdd another longer text box called (text1). add a command button called (Command1)change the caption to "find com port". now add another text box called (text1).
>i add a longer textbox and change the text as text1, then i add a command button and change the caption into find com port, then i add another textbox and change the text text1kindly check RPCoyle if all of this are right or did we understand each other..thanks!
|
|
|
|
|
7
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: June 18, 2012, 06:56:03 am
|
it's comport 1 RpCoyle...i can see on the serial monitor the "<R>" and the rest of this when i hit the button with the commport value which is commport1... how about correcting those components i put on my vb.?.just try to correct this: as i open the vb application first thing i did was inserting the component, i open the Project/components/controls/(i check the) micsrosoft comm control 6.0..after that i put the component that appears on the toolbox picture like a telephone on the form, then i put a textbox and a shape on a form also.. my regard is, is this all right.?. 
|
|
|
|
|
8
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: June 05, 2012, 05:19:05 pm
|
|
actually, you can set the comport on any vacant or not in used port...right.?. now base on what you've ask RPCoyle it's Commport 1..whenever i open the arduino then go to tools/serial port it's comport 1..then when i open the serial monitor it's still com1... but i can change this if ever i want by just right clicking the computer/properties/device manager/port(COM & LPT)/port settings/advance/comport number..
|
|
|
|
|
9
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: June 05, 2012, 07:34:31 am
|
hello again... i just want to show you my edited code..this code will be able to access the switch button which is connected in arduino when i run the vb application..i just inserted your code RPCoyle in finding the commport...just take a look if what is lacking on this because i can only access the button switch but nothing sends to vb application or we may say the circle doesn't fill any color....  Option Explicit ' this is added to allow the sleep call Private Declare Sub Sleep Lib "kernel32" ( _ ByVal dwMilliseconds As Long)
Private Sub Form_Load() Dim mystr As String Dim FoundIt As Integer Dim ComFail As Integer Dim FailErr As Integer Dim n As Integer
MSComm1.Settings = "9600,N,8,1" FoundIt = False ' find USB port ComFail = False FailErr = False For n = 1 To 1 If MSComm1.PortOpen Then MSComm1.PortOpen = False On Error Resume Next MSComm1.CommPort = 1 On Error Resume Next 'MSComm1.DTREnable = True 'MSComm1.RThreshold = 4 'MSComm1.SThreshold = 3 MSComm1.InputLen = 0 MSComm1.PortOpen = True Next End Sub
Private Sub LEDOn(col As Long)
Shape1.BackColor = col End Sub
Private Sub LEDOff()
Shape1.BackColor = &HFFFFFF End Sub
Private Sub MSComm1_OnComm() Dim strData As String Static strBuffer As String Dim strWords() As String Dim intPos As Integer Dim boComplete As Boolean Dim mystr As String
Sleep 1000 ' this waits one second between readings from the Arduino mystr = "" ' set the string to nothing mystr = MSComm1.Input intPos = InStr(mystr, "<") If intPos > 0 Then Select Case Mid(mystr, 1, 3) ' strip off the CR/LF Case "<Y>" Text1.Text = ("The pressures value is 80 psi") Call LEDOn(&HFFFF&) ' this is in hex Case "<B>" Text1.Text = ("The pressures value is 60 psi") Call LEDOn(&HFF0000) ' this is in hex Case "<R>" Text1.Text = ("The pressures value is 20 psi") Call LEDOn(&HFF&) ' this is in hex Case "<G>" Text1.Text = ("The pressures value is 40 psi") Call LEDOn(&HFF00&) ' this is in hex Case Else Call LEDOff End Select End If End Sub
thanks 
|
|
|
|
|
10
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: June 05, 2012, 07:17:52 am
|
hi RPCoyle am sorry if i keep on inquiring 'coz until now still i find nothing.. base on what you said, i had two installer of arduino the latest version which is the 1.0 and also the .0021....i used the old version which is the .0021 and yet it works on the arduino..i can see in the serial monitor the <R> and so on when i press the switch button but when i run the vb6 application and press the button switch nothing happens..seems it goes back to the problem before that when i run the arduino then next to that is the vb app then as i pressed the button switch the LED will not flash or nothing happens to it...  hope you understand me..  thanks
|
|
|
|
|
11
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: May 28, 2012, 03:37:57 pm
|
Private Sub Form_Load() Dim mystr As String Dim FoundIt As Integer Dim ComFail As Integer Dim FailErr As Integer Dim n As Integer
MSComm1.Settings = "9600,N,8,1" FoundIt = False ' find USB port ComFail = False FailErr = False For n = 1 To 1 If MSComm1.PortOpen Then MSComm1.PortOpen = False On Error Resume Next MSComm1.CommPort = 1 On Error Resume Next MSComm1.DTREnable = True MSComm1.RThreshold = 4 MSComm1.SThreshold = 3 MSComm1.InputLen = 0 MSComm1.PortOpen = True Next End Sub the above code is what i edit using your code to find the comport... 2. another thing is that, when i run the vb application and then hit the button it prompts an error in which i enclose in quote...then it points on the code above where i put a comment Run-time error reading '8020': Error reading comm device
Private Sub MSComm1_OnComm() Dim strData As String Static strBuffer As String Dim strWords() As String Dim intPos As Integer Dim boComplete As Boolean Dim mystr As String
Sleep 1000 ' this waits one second between readings from the Arduino mystr = "" ' set the string to nothing mystr = MSComm1.Input ////in this area the error points out intPos = InStr(mystr, "<") If intPos > 0 Then Select Case Mid(mystr, 1, 3) ' strip off the CR/LF Case "<Y>" Text1.Text = ("The pressures value is 80 psi") Call LEDOn(&HFFFF&) ' this is in hex
i need some help on how to fix this.. thanks!
|
|
|
|
|
12
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: May 27, 2012, 10:40:10 pm
|
below are the code i edited which come from you..i add the code you posted in previous to find the port but i guess there still lacking in this.. Option Explicit ' this is added to allow the sleep call Private Declare Sub Sleep Lib "kernel32" ( _ ByVal dwMilliseconds As Long)
Private Sub Form_Load() Dim mystr As String With MSComm1 FoundIt = False // when i run this vb app. an error occurs here stating not define... 'find USB port ComFail = False FailErr = False If MSComm1.PortOpen = True Then MSComm1.PortOpen = False On Error Resume Next .CommPort = 2 ' *************** YOU MAY NEED TO CHANGE THIS OR ADD MY CODE TO FIND THE COM PORT************************ .Settings = "9600,N,8,1" On Error Resume Next .InputLen = 0 .DTREnable = True .RTSEnable = True .RThreshold = 4 .SThreshold = 3 .PortOpen = True
End With End Sub
Private Sub LEDOn(col As Long)
Shape1.BackColor = col End Sub
Private Sub LEDOff()
Shape1.BackColor = &HFFFFFF End Sub
Private Sub MSComm1_OnComm() Dim strData As String Static strBuffer As String Dim strWords() As String Dim intPos As Integer Dim boComplete As Boolean Dim mystr As String
Sleep 1000 ' this waits one second between readings from the Arduino mystr = "" ' set the string to nothing mystr = MSComm1.Input intPos = InStr(mystr, "<") If intPos > 0 Then Select Case Mid(mystr, 1, 3) ' strip off the CR/LF Case "<Y>" Text1.Text = ("The pressures value is 80 psi") Call LEDOn(&HFFFF&) ' this is in hex Case "<B>" Text1.Text = ("The pressures value is 60 psi") Call LEDOn(&HFF0000) ' this is in hex Case "<R>" Text1.Text = ("The pressures value is 20 psi") Call LEDOn(&HFF&) ' this is in hex Case "<G>" Text1.Text = ("The pressures value is 40 psi") Call LEDOn(&HFF00&) ' this is in hex Case Else Call LEDOff End Select End If
End Sub
i appreciate most your help! 
|
|
|
|
|
13
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: May 27, 2012, 10:08:35 pm
|
hello.. Private Sub Form_Load() With MSComm1 If .PortOpen Then .PortOpen = False .CommPort = 2 // i change the comport into 2 as what i had seen in serial monitor of arduino .Settings = "9600,N,8,1" .DTREnable = True .RTSEnable = True .RThreshold = 4 .SThreshold = 3 .PortOpen = True End With End Sub
RPCoyle, i used your code and yet it works but it goes back to the problem before that when i try to hit the switch button the Led connected in pin 9 will not light and so on...it seems nothing happens when i use to run the vb application..the communication between arduino to vb are not functioning or we may say that i can't access the input from arduino to vb...but if i try the code below: Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Private Sub MSComm1_OnComm() Dim Str As String MSComm1.Settings = "9600,N,8,1" FoundIt = False ' find USB port ComFail = False FailErr = False For n = 1 To 16 If MSComm1.PortOpen = True Then MSComm1.PortOpen = False On Error Resume Next MSComm1.CommPort = n On Error Resume Next MSComm1.InputLen = 0 MSComm1.PortOpen = True If MSComm1.CommID > 0 Then strt = InStr(Str, "<") + 1 fin = InStr(Str, ">") If (fin - start) <= 0 Then Else: ColorStr = Mid(Str, start, (fin - strt)) End If
If MSComm1.PortOpen = False Then MsgBox "Controller Not functioning , Please check USB connection", vbCritical, "": ComFail = True: Exit Sub
jump: ' your case statement ' Debug.Print ">"; Str; "<"; Select Case (Str) ' set a break point here so you can step through the case statement Case "A" Call LEDOn(vbRed) Case "B" Call LEDOn(vbGreen) Case "C" Call LEDOn(vbBlue) Case "D" Call LEDOn(vbYellow) Case Else Call LEDOff End Select End If 'Exit Function End Sub
Private Sub LEDOn(col As Long) Shape1.FillColor = col End Sub
Private Sub LEDOff() Shape1.FillColor = vbWhite End Sub
i can access the input from arduino when i run the vb application..
|
|
|
|
|
14
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: May 21, 2012, 11:51:42 pm
|
hi again!..i feel sorry for the delay.. michael_x..i can see already the comport number when i use to plug the arduino it's comport 1...yet, i set the comport as a .CommPort = 1 and as what you said that i should change or add your code for me to find the comport but when i add your code it prompts an error on: FoundIt = False // in this code an error occur stating that it was not being defined... ' find USB port ComFail = False FailErr = False For n = 1 To 16 ' find USB port ComFail = False FailErr = False For n = 1 To 16 If MSComm1.PortOpen = True Then MSComm1.PortOpen = False On Error Resume Next MSComm1.CommPort = n ... base on my understanding, this line of codes set for finding the comport...
|
|
|
|
|
15
|
Using Arduino / Interfacing w/ Software on the Computer / Re: arduino+vb6
|
on: May 09, 2012, 08:49:58 pm
|
hi again.!. RPCoyle, your right that i should add the code you posted in the code below because when i use to debug this it never finds the comport1, (i already change the commport 7 to commport 1)..let us say that i should close the arduino first before it runs..now, i edit the code and add your code but when i debug the vb application an error prompts me that the < FoundIt does not define.> i search through the net some samples on how it was going to be declared but still i find nothing..Perhaps, you know this much will you please help me again for this..  With MSComm1 If .PortOpen Then .PortOpen = False .CommPort = 7 ' *************** YOU MAY NEED TO CHANGE THIS OR ADD MY CODE TO FIND THE COM PORT************************ .Settings = "9600,N,8,1" .DTREnable = True .RTSEnable = True .RThreshold = 4 .SThreshold = 3 .PortOpen = True
Thanks!
|
|
|
|
|