Pages: 1 [2]   Go Down
Author Topic: interfacing the arduino to vb6  (Read 4141 times)
0 Members and 1 Guest are viewing this topic.
Santa Fe
Offline Offline
Full Member
***
Karma: 1
Posts: 201
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

try this...
Code:
' set up the code for the input through MSComm1....

 str = MSComm1.Input  ' get the string
 str = Left(str,1)  ' chops off the first char and puts it back in str
 Debug.Print ">"  str  "<"  ' now you can see what is coming through in the immediate window of VB
 Select Case (str) ' set a "beak point " here in VB to stop the processing so you can step through the case
   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
 
' on the Arduino side just send out    Serial.println("A")

'why send out a whole line of text if you don't need it

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


[/quote]
Lets walk through one case. You press the switch connected to pin 2 on the Arduino. The Arduino sends "R5" to the serial port, along with a carriage return and line feed, and flashes the LED on pin 7.
Quote

.great PaulS smiley-wink you got the idea of mine, this is what i wanted to be..but i just want to clarify that pin 7 is our buzzer, whenever something is pressed it will buzz accordingly to it's precise times...so, our output pin will start on pin 9..therefore the switch connected to pin 2 has an output LED on pin 9.
thanks you so much guys for helping me. smiley-wink

RPCoyle, i try the code you posted but still nothing sends to the vb.. smiley-sad-blue

to PaulS:
Quote
While not running the VB app, open the Serial Monitor. You should see R5 in the serial monitor window, on a new line, and the LED on pin 7 should flash every time you press the switch connected to pin 2. Do both of those things happen?

.yes precisely both of them happens.. smiley

Quote
Presuming that they do, close the Serial Monitor, and run the VB application.

i was thinking why everytime i used to run the vb application then afterwards when i am going to press the switch connected to pin 2 the LED 9 didn't flash anymore..maybe that was the problem why there is nothing sends to vb...what do you think..?.

another thing, some of my friends told me that maybe i should use < dll > or any software for this..is it true.?.if so, i don't know about dll or those particular software for this..
Logged

Pages: 1 [2]   Go Up
Jump to: