It does what it should, but only when using the Serial Monitor.
I've used hterm, another COM sniffer and my own C# program to try to get the values but didn't succeed. Settings were correct.
If it works with the Serial Monitor then you must have incorrect settings in the other programs.
You need to select the correct COM port and the serial settings should be 8 bits, no parity and 1 stop bit (8N1). And, of course the correct baud rate.
If you need more help please post your complete Arduino program.
To be honest if you can see the data in the serial monitor then any terminal program should do exactly the same as long as you are opening the same port.
Make sure you close the serial monitor.!!
It maybe one of the control lines holding the device in reset or slipping it into program mode.
I forget if it was DTR or RTS.
Just make sure the port is opening, and that you are not sending char(0) too much.
Does the device respond to outgoing serial commands even if you can't see any incoming data.
You can also just short RX and TX on the board to see if a simple loopback test works.
Robin2:
If it works with the Serial Monitor then you must have incorrect settings in the other programs.
You need to select the correct COM port and the serial settings should be 8 bits, no parity and 1 stop bit (8N1). And, of course the correct baud rate.
If you need more help please post your complete Arduino program.
...R
If I hadn't double, triple, quadruple checked all you just said, I wouldn't be posting.
As I said, I suppose the program works correctly, as I get results in the IDE, so posting "all of it" wouldn't make any difference. But it is in attachment.
Hiddenvision:
Hi Tobias,
To be honest if you can see the data in the serial monitor then any terminal program should do exactly the same as long as you are opening the same port.
Make sure you close the serial monitor.!!
It maybe one of the control lines holding the device in reset or slipping it into program mode.
I forget if it was DTR or RTS.
Just make sure the port is opening, and that you are not sending char(0) too much.
Does the device respond to outgoing serial commands even if you can't see any incoming data.
You can also just short RX and TX on the board to see if a simple loopback test works.
I know, that's exactly why I'm asking. It is a really odd and weird behaviour.
Is the code of the Serial Monitor open source, so I can reverse engineer this?
tscheipel:
Is the code of the Serial Monitor open source, so I can reverse engineer this?
It is. But it would be a complete waste of your time studying it.
There is nothing in your program that would prevent it working with any other Terminal program.
I don't have your sensors. You might like to try this simple program which works with minicom on my Linux PC.
void setup() {
// put your setup code here, to run once:
// Serial port
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("Hello World");
delay(1000);
}
I can only conclude that there is something wrong with your Terminal settings. Or maybe you don't have some Operating System permission?
Ya, no. But thanks for your effort. Also works when mapping the device in a VirtualBox and using Linux.
Seems to be a Windows issue, but no idea what it is. I'll keep you updated, if I find something.
You didn't show the C# code you tried but here is one of the options I would use as an interface, it's simply a form that contains a rich text box control and the baud and com should be configured to match your arduino.
using System;
using System.Windows.Forms;
using System.IO.Ports;
namespace ArduinoMonitor
{
public partial class Form1 : Form
{
SerialPort myport = new SerialPort();
public delegate void StringDelegate(string sData);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
myport.PortName = "COM7";
myport.BaudRate = 9600;
myport.NewLine = "\r\n";
myport.DtrEnable = true;
myport.Open();
myport.ReadExisting();
myport.DataReceived += new SerialDataReceivedEventHandler(myport_DataReceived);
}
private void myport_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
myport.ReadTimeout = 50;
try
{
string str = myport.ReadLine();
this.BeginInvoke((new StringDelegate(StringDebug)), str);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void StringDebug(string sData)
{
richTextBox1.AppendText(sData + "\n");
}
}
}
sumguy:
You didn't show the C# code you tried but here is one of the options I would use as an interface, it's simply a form that contains a rich text box control and the baud and com should be configured to match your arduino.
using System;
using System.Windows.Forms;
using System.IO.Ports;
namespace ArduinoMonitor
{
public partial class Form1 : Form
{
SerialPort myport = new SerialPort();
public delegate void StringDelegate(string sData);
The extra DTR and RTS signals are generated on the USB ic on the external board.
Arduinos and others use those pins to either reset or reset into flash mode.
Some USB devices do not offer the pins to external headers so don't be angry if your USB convertor does not have them. The Chip will.!!
Some being CP201x or CH340 IC's
There is a post in the Hacking section I think that shows how to mod one of the popular converters if desired.