Pages: [1]   Go Down
Author Topic: Sending String from Arduino Uno to Vb.net Using Firmata  (Read 2357 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

EchoString.pde
Code:
/* 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)
{
    Firmata.sendString(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);
    Firmata.begin(9600);
}

void loop()
{
    while(Firmata.available()) {
        Firmata.processInput();
    }
}





And in Vb.net

Code:
Public Class Form1
Private Sub SimpleButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton1.Click
        FirmataVB1.Connect("COM14", 9600)
        FirmataVB1.QueryVersion()
        MsgBox(FirmataVB1.SerialPort1.ReadLine)
            MemoEdit1.Text = (FirmataVB1.SerialPort1.ReadLine).ToString
        MsgBox("COnnect")
    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?
thanks.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 4
Posts: 320
Arduino - very interesting !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

did you get ot the bottom of this ?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are some issues with COM ports 10 and above, with some software.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1192119372
show how to define the name of a port 10 or above. Perhaps this will make a difference.
Logged

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

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:
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        arduino1.StartSysex()
        arduino1.mycommand1(20, 1)
        arduino1.EndSysex()
        Thread.Sleep(100) 'Delay less than a second
        arduino1.processInput()
        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
Logged

Pages: [1]   Go Up
Jump to: