Go Down

Topic: interfacing the arduino to vb6 (Read 8357 times) previous topic - next topic


try this...
Code: [Select]

' 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


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.

.great PaulS ;) 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. ;)

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

to PaulS:

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.. :)


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..

Go Up