can you help us how to transmit wirelessly using XBee and arduino with VB 2010 express as a GUI..thanks
can you help us how to transmit wirelessly using XBee and arduino with VB 2010 express as a GUI..thanks
It's EXACTLY the same as with a wire.
im a newbie in arduino.. can you give me the code?
i appreciate your reply.. thank you sir!
can you give me the code?
No. You seem to have jumped into the deep end without looking. I suggest that you get out of the pool, go around to the shallow end, and get back in.
When you can do some simple projects, with Serial.begin(), Serial.print(), Serial.available(), and Serial.read(), you'll know the answer to the question, and won't need to ask it.
i'll try..
i'll give up my output later if a can make it..
thank you by the way!
sir!
i had done one experiment on wireless transmission via xbee and arduino..
it is a simple blinking LED at pin 13..
here is the code..
TX:
int ledPin= 13;
void setup()
{
 digitalWrite(ledPin, LOW);
 Serial.begin(9600);
}
void loop()
{
 Serial.print('H');
 delay(500);
 Serial.print('L');
 delay(500);
 }
}
RX:
int ledPin=13;
char val;
void setup()
{
 Serial.begin(9600);
 pinMode(ledPin, OUTPUT);
 digitalWrite(ledPin, LOW);
}
void loop()
{
 if (Serial.available() > 0)
 {
  val = Serial.read();
  if (val == 'H')
  {
   digitalWrite(ledPin, HIGH);
  }
  if (val == 'L')
  {
   digitalWrite(ledPin, LOW);
  }
 }
}
but when i try to interface it to VB 2010 i did'nt get an output, im supposed to control an LED via wireless through xbee and arduino with VB..
here is the code for the latter sir..
TX:
int ledPin= 13;
void setup()
{
Â
 Serial.begin(9600);
 pinMode(ledPin, OUTPUT);
 digitalWrite(ledPin, LOW);
}
void loop()
{
 if (Serial.available () > 0);
 char val = Serial.read () - '0';
Â
 if (val == 1)
 {Â
  Serial.print('H');
 }
 if (val == 0)
 {
  Serial.print('L');
 }
}
RX:
int ledPin=13;
char val;
void setup()
{
 Serial.begin(9600);
 pinMode(ledPin, OUTPUT);
 digitalWrite(ledPin, LOW);
}
void loop()
{
 if (Serial.available() > 0)
 {
  val = Serial.read();
  if (val == 'H')
  {
   digitalWrite(ledPin, HIGH);
  }
  if (val == 'L')
  {
   digitalWrite(ledPin, LOW);
  }
 }
}
is there something wrong in the sketch?
hoping for your reply sir, thank you!
i had done one experiment on wireless transmission via xbee and arduino..
it is a simple blinking LED at pin 13..
Does this work?
If so, then you know that the XBees are configured correctly, so you are more than half way there.
but when i try to interface it to VB 2010 i did'nt get an output, im supposed to control an LED via wireless through xbee and arduino with VB..
if (Serial.available () > 0);
If there is serial data available, so nothing (;). Otherwise, do nothing.
The purpose of this test is?
You didn't get an output where?
What does your VB code look like?
yes my first experiment did work..
here's the code for the GUI sir..
Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Public Class Form1
Shared _continue As Boolean
Shared _serialPort As SerialPort
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SerialPort1.Close()
SerialPort1.PortName = "com10" 'change com port to match your Arduino port
SerialPort1.BaudRate = 9600
SerialPort1.DataBits = 8
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.Handshake = Handshake.None
SerialPort1.Encoding = System.Text.Encoding.Default 'very important!
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SerialPort1.Open()
SerialPort1.Write("1")
SerialPort1.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SerialPort1.Open()
SerialPort1.Write("0")
SerialPort1.Close()
End Sub
End Class
i think that test is for the arduino o receive data from VB.. is that right sir? i am not sure...
i did'nt get an output at pin 13 on arduino on the RX side..
what i want to do is when i press the "ON" button on my GUI it should turn on the pin 13 on the arduino RX side..
but nothing happens sir..
Perhaps you are not aware that opening and closing the serial port resets the Arduino.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SerialPort1.Open()
SerialPort1.Write("1")
SerialPort1.Close()
End Sub
Open, causing a reset. Immediately, before the reset is complete, send a value. Then, immediately close the port, causing another reset. The end result is just as though you hadn't sent anything.
You need a connect button that opens the serial port, and a disconnect button that closes the serial port. The Button1 and Button2 click event handlers should NOT open and close the port.
sir!
i tried another experiment.. this time i removed the xbee on the arduino and try to control the arduino(not wireless)using the visual basic and it worked.. when i clicked the "ON" button on the GUI the pin 13 at the arduino resdponded and turned on..
my problem is that when i do it on a wireless nothing seems to happen..
is the problem on the adruino sketch or in the VB code itself.. thank you sir!
my problem is that when i do it on a wireless nothing seems to happen.
Then the problem is with the configuration of the XBees.
is the problem on the adruino sketch or in the VB code itself.
If it works with wires, no.