I intended to make an interface so that the data can be viewed on a computer, but I am confused make an interface with c #, does anyone have a sample program with c # arduino xbee? or how to connect data between arduino + xbee + sensor to apllication with c# because my code not running..
there my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
namespace coba_arduino
{
public partial class Form1 : Form
{
private StringBuilder recievedData = new StringBuilder();
public Form1()
{
InitializeComponent();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
serialPort1.PortName = cmbCOMPort.Text;
if (!serialPort1.IsOpen)
serialPort1.Open();
}
private void Form1_Load(object sender, EventArgs e)
{
foreach (string portname in SerialPort.GetPortNames())
{
cmbCOMPort.Items.Add(portname);
}
timer1.Start();
}
private void button2_Click(object sender, EventArgs e)
{
if (serialPort1.IsOpen)
serialPort1.Close();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (serialPort1.IsOpen)
serialPort1.Close();
}
private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
recievedData.Append(serialPort1.ReadExisting());
}
private void timer1_Tick(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.ToString();
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
and show when i'm running the program :
very need help..
im sorry my english bad..