Linux USB Serial to Arduino.

Hi!

I need some guide where to start and the best approach to:

I have downloaded some firmware to the Arduino UNO which control a shield by serial com.

If I use Serial Monitor I can control Arduino UNO byt serail commands,

Now I would like to work on C perhaps C++ to create a virtual serial interface to my Arduino through the USB port. Could you please help? Thanks

Last I checked, you can open the device like a file, and associate it with a stream handle.
Google search "linux open usb device".

I have downloaded some firmware to the Arduino UNO

What firmware? From where?

which control a shield

Which one?

Now I would like to work on C perhaps C++ to create a virtual serial interface to my Arduino through the USB port.

If you are able to send serial data to the Arduino, you must have observed that the Arduino is capable of reading serial data. The Serial documentation is all you need to know.

Hi!

The firmware is this one:

SoftwareSerial mySerial(2, 3);

void setup() 
{
  //Serial connection.
  mySerial.begin(9600);
  Serial.begin(9600);
 

};

void loop() 
{
  
   if (mySerial.available())
    Serial.write(mySerial.read());
    //Serial.println("GSM we got 1.");
  if (Serial.available())
    mySerial.write(Serial.read());
   // Serial.println("GSM we got 2.");
 
};

The Shield: SIM900 GSM (no sure what is all this is relevant)

The problem is not the Arduino now, I am want to work on the PC application side.

Hi SurferTim!

Do you have actually some code example?

I am doing similar like fx2 but I get stuck on

usb_set_configuration

I use : usb_set_configuration(usbhandle,2);

but it return -16

also usb_claim_interface gives error

Thanks

The reference pages list a large number of examples for interfacing with the Arduino: Arduino Playground - InterfacingWithSoftware

Peter, treat the Arduino as a serial device and not a USB device.

Hi Chagrin!

That is the kind of answer I was looking for! :slight_smile:

I use some C code on the website and at least I am getting something. There is something strange after I run that C code,> cat command in a terminal is not working properly and they other thing that C code on the website does not work very well either I need to introduce delay or I will get nothing and If I send additional data while it wait I dont get in read on the terminal.

You may be asking what I am trying to do I just want the arduino start sending "data" and then have a C or C++ analysing the data all the time and take action when a condition in on the data happen.