Hello,
I’m trying to figure out, what and how can get as unique identification number or any other kind of ID equivalent from particular Arduino Uno micro-controller from C# desktop application with serial port data
In case of Uno, I have COM3 open:
myport.PortName = comPort;
myport.BaudRate = 9600;
myport.Open();
But I’m not sure, how to read such data as ID of chip, for example with EEPROM Get :
#include <EEPROM.h>
void setup() {
float f = 0.00f;
int eeAddress = 0;
Serial.begin(9600);
while (!Serial) {
}
Serial.print("Read float from EEPROM: ");
EEPROM.get(eeAddress, f);
Serial.println(f, 3);
secondTest(); //Run the next test.
}
struct MyObject {
float field1;
byte field2;
char name[10];
};
void secondTest() {
int eeAddress = sizeof(float);
MyObject customVar;
EEPROM.get(eeAddress, customVar);
Serial.println("Read custom object from EEPROM: ");
Serial.println(customVar.field1);
Serial.println(customVar.field2);
Serial.println(customVar.name);
}
void loop() {}
and C#:
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = myport.ReadExisting();
}
I get some completely misunderstood result:
** Read float from EEPROM: ovf**
** Read custom object from EEPROM:**
** ovf**
** 95**
** _^^]]]\\fedc**
What must be the output variable to get unique id from particular micro-controller:
Serial.println(customVar.field2);
Serial.println(customVar.name);