Serial communication and Access forms

  • Thread starter Thread starter nicoacosta8
  • Start date Start date
N

nicoacosta8

Guest
Hi!

I'm having an issue regarding regarding serial communication and vb coding (notice I'm a newbie).

I'm receiving serial info from Arduino in a COM port. This info can be 0, 1 and eventually a different large combination of numbers and letters.

So the serial monitor looks something like this.

1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-0-0-0-0-0-0-0-0-1-1-1-1-1-1-1-1-1-1-5859AK48K6-1-1-1-1-1-1-1-1 etc... (every "-" being a line between characters)

1) In raw english what I would like to do is:

If "I get something different (xxxxxxxx) from SerialMonitor" Then

"Open a determined Access form in the (xxxxxxxx) register/Run a macro doing so"
"And sleep for 2 secs (don't do anything even if it gets 1, 0, or xxxxxxxx"

ElseIf "I get a 0 from SerialPort" Then

"Open a determined Access form/run a macro doing so and play a .mp3 file" Then

ElseIf "I get 1 from SerialPort" Then

"Open a determined Access form/run a macro doing so"

End If



The thing which I think is the most difficult of this is that having a baud rate of 9600 or higher, everytime it reads serial in the Main() sub, if has more than 1 character/input.

So everytime it reads, it is like
1
1
1
1
1
xxxxxxxx
0
0
0
1
1
1
1
1

Therefore, having this kind of 'blocks' I need it not to read the first 0/1/xxxxxxxx, but to see if it contains those things in the previous order so:

if "it contains xxxxx" then
...
elseif "it cointains 0" then
...
elseif "it contains 1" then
...
end if



2) The other question is that ideally, depending on what the xxxxxxxx is, it should open one form or other.
So if in an Access table/CSV file, xxxxxxx read corresponds to a True/1/Yes value, it should open an A form in that register. And if in that table, xxxxxxxx read corresponds to a False/No/0 value, it should open a B form in that register, and play a mp3 file. (This 0 and 1 ar not related to the serial com input)


I hope you can help me with this.

Every answer will help a lot. regarding the serial com, the access part or if you could think of an easier way to do this.

Thanks in advance!!

Continue reading...
 
Back
Top