Go Down

Topic: Sending String from Arduino Uno to Vb.net Using Firmata (Read 3135 times) previous topic - next topic


Hi every one...
I would like to send string from Uno to Vb.net .

Code: [Select]

/* This sketch accepts strings and raw sysex messages and echos them back.
* This example code is in the public domain.
#include <Firmata.h>

byte analogPin;

void stringCallback(char *myString)

void sysexCallback(byte command, byte argc, byte*argv)
   Serial.print(START_SYSEX, BYTE);
   Serial.print(command, BYTE);
   for(byte i=0; i<argc; i++) {
       Serial.print(argv[i], BYTE);
   Serial.print(END_SYSEX, BYTE);

void setup()
   Firmata.setFirmwareVersion(0, 1);
   Firmata.attach(STRING_DATA, stringCallback);
   Firmata.attach(START_SYSEX, sysexCallback);

void loop()
   while(Firmata.available()) {

And in Vb.net

Code: [Select]

Public Class Form1
Private Sub SimpleButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton1.Click
       FirmataVB1.Connect("COM14", 9600)
           MemoEdit1.Text = (FirmataVB1.SerialPort1.ReadLine).ToString
   End Sub
End Class

When i try to connect...vb.net return nothing, only waiting for the responding until error occurs.

Anyone knows how to solve the problem?



There are some issues with COM ports 10 and above, with some software.
show how to define the name of a port 10 or above. Perhaps this will make a difference.
The art of getting good answers lies in asking good questions.


For those who have problems with Firmata's sysex and want to acess sysex comands easily:

Try http://connect.mind-craft.net/arduino-firmata-vb-class - change "storedInputData" variable to public and use it, e.g.:

Code: [Select]
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        arduino1.mycommand1(20, 1)
        Thread.Sleep(100) 'Delay less than a second
        TextBox1.Text = arduino1.storedInputData(1)
End Sub

use https://github.com/jgautier/arduino-1/blob/master/examples/EchoString/EchoString.ino
and read http://firmata.org/wiki/Protocol to add your own sysex command to Arduino.vb

Go Up