I am using the EM406 GPS tester and I am able to see the data through the serial monitor.
I've typed a simple C# program to read.
Please correct me if I am wrong somewhere.
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 DarrenGPS_program
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string stx;
SerialPort sp = new SerialPort();
private void button1_Click(object sender, EventArgs e)
{
if (sp.IsOpen)
{
sp.Close();
}
try
{
sp.PortName = "COM32";
sp.BaudRate = 57600;
sp.Parity = System.IO.Ports.Parity.None;
sp.DataBits = 8;
sp.StopBits = System.IO.Ports.StopBits.One;
sp.Open();
sp.WriteLine("\r");
stx = sp.ReadExisting();
listBox1.Items.Add(stx);
MessageBox.Show("OK");
}
catch (System.Exception)
{
//Creates and returns a string representation of the current exception.
MessageBox.Show("Communication Error");
}
}
}
}
And that I am seeing is this
Why is this so? There is nothing appearing in the list box except for a "." sometimes.
Do I have any problem with my C# program?
Some comments and feedback appreciated.
Darren
Replies
From the above results, and after viewing the program in arduino.
It seem like the program stops running after running until the line
"decode_gps();
Serial.print(".");"
Which I think that it did not even run the "print_position();" method.
The blue box are the things which I want to read in the C# program.