Run script or java

Hello Arduiono world,

Is it possible run shell script from arduino? For example:

My Arduino is connected to my notebook linux OS (Ubuntu).

May I run shell script or java after turn off the led ?

sorry for strange question

Thanks in advance

May I run shell script or java after turn off the led ?

No.

You can send data to the PC, via the serial port. If there is an application running, and listening to the serial port that the Arduino is connected to, that application can then run some other application.

PaulS:

May I run shell script or java after turn off the led ?

No.

You can send data to the PC, via the serial port. If there is an application running, and listening to the serial port that the Arduino is connected to, that application can then run some other application.

Many thanks for your reply. Do you have any example of how to send data via serial port?

King Regards

Do you have any example of how to send data via serial port?

char *data = "Well, duh!";
Serial.print(data);

This demo shows how to communicate between a PC using Python and an Arduino. The same principles apply to any PC programming language.

...R

Thank you all for your reply. I've resolved using ubuntu serial port terminal and with Serial.print() method.

Now trying to add Time library to get current time but it doesn't work (even trying to intall manually) :(

Thanks again

Arsen: Now trying to add Time library to get current time but it doesn't work (even trying to intall manually) :(

If this is an Arduino issue post your code and the errors you are getting.

...R

Robin2:

Arsen:
Now trying to add Time library to get current time but it doesn’t work (even trying to intall manually) :frowning:

If this is an Arduino issue post your code and the errors you are getting.

…R

I cant see any error message, in the scetch menu / libraries i can see the Time but when trying to impot, it just add an empty line, when manually posting #include<Time.h> then getting error not found Time.h :frowning:

Arsen:
I cant see any error message, in the scetch menu / libraries i can see the Time but when trying to impot, it just add an empty line, when manually posting #include<Time.h> then getting error not found Time.h :frowning:

If you won’t post your code I can’t help.

…R

Robin2:

Arsen:
I cant see any error message, in the scetch menu / libraries i can see the Time but when trying to impot, it just add an empty line, when manually posting #include<Time.h> then getting error not found Time.h :frowning:

If you won’t post your code I can’t help.

…R

The code is a simple blink example where trying to get current time when led is on.

#include<Time.h>

int led = 13;

void setup() {

pinMode(led, OUTPUT);
}

void loop() {

digitalWrite(led, HIGH);

// write current time when led is turned on.
Serial.println("Led on at: ");

delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
and error below when cmpiling

Blink.ino:2:17: fatal error: Time.h: No such file or directory
compilation terminated.

thanks & regards

Blink.ino:2:17: fatal error: Time.h: No such file or directory

Seems fairly self explanatory to me. Do you have a file named Time.h in a folder called Time in the libraries folder of your sketch directory ?

UKHeliBob:

Blink.ino:2:17: fatal error: Time.h: No such file or directory

Seems fairly self explanatory to me. Do you have a file named Time.h in a folder called Time in the libraries folder of your sketch directory ?

Yes I`ve checked already...

regards

I assume that you have stopped and started the IDE since installing the library and that other libraries installed in the same folder work OK. The most common cause of problems with libraries is that they are installed in the wrong place, usually the Arduino libraries folder. that the folder does not have the same name as the .h and .cpp files or that an extra folder has been created under the sketch folder\libraries\library folder.

What is the full path to the Time.h file ?

UKHeliBob: I assume that you have stopped and started the IDE since installing the library and that other libraries installed in the same folder work OK. The most common cause of problems with libraries is that they are installed in the wrong place, usually the Arduino libraries folder. that the folder does not have the same name as the .h and .cpp files or that an extra folder has been created under the sketch folder\libraries\library folder.

What is the full path to the Time.h file ?

The full path from terminal is: /usr/share/arduino/libraries/Time and I think you're right, I have a Time folder and inside is another Time folder where stored DateStrings.cpp, Examples, keywords.txt, Readme.txt, Time.cpp, Time.h files/folders

I have to copy them into the first Time folder and hope will work.

A Hug thanks to all for your help. I'll let you know if the issue was the above mentioned.

#include<Time.h>

int led = 13;

void setup() {               

  pinMode(led, OUTPUT);     
}

void loop() {
 
  digitalWrite(led, HIGH); 
 
  // write current time when led is turned on.
    Serial.println("Led on at: ");
 
  delay(1000);           
  digitalWrite(led, LOW); 
  delay(1000);         
}

This code which I copied from your earlier post in Reply #9 compiles fine for me.

As far as I can see the line that has been causing you a problem is not included in it. That makes it a bit hard to help you.

…R

Robin2: As far as I can see the line that has been causing you a problem is not included in it. That makes it a bit hard to help you. ...R

The problem is that now even it is adding the library, when trying to compile getting the famous error:

DateStrings.cpp:50:24: error: variable ‘dayShortNames_P’ must be const in order to be put into read-only section

((

Arsen: The problem is that now even it is adding the library, when trying to compile getting the famous error:

I don't mean to sound unkind, but the real problem is that you are not approaching the business of finding the problem in a systematic manner.

The only code I have seen, so far, is in Reply #9. That code does not give any error on my PC. I believe that is because the problem line is not included. But you have ignored that issue completely and you have now introduced some other problem.

Post the code that is causing these problems. If you won't do that I am not going to try to help.

...R

Robin2:

Arsen:
The problem is that now even it is adding the library, when trying to compile getting the famous error:

I don’t mean to sound unkind, but the real problem is that you are not approaching the business of finding the problem in a systematic manner.

The only code I have seen, so far, is in Reply #9. That code does not give any error on my PC. I believe that is because the problem line is not included. But you have ignored that issue completely and you have now introduced some other problem.

Post the code that is causing these problems. If you won’t do that I am not going to try to help.

…R

It is the code that Im using, Im not added any code to get the time yet, just put include Time and compiling got the error. Check the screen shot below.

OK. The code in the screen shot doesn't have the lines

  // write current time when led is turned on.
    Serial.println("Led on at: ");

which are in the code in Reply #9. However that small difference should not matter. It should compile without error.

It seems you do have a very strange problem - hence my reluctance to believe it. I wonder if the Arduino IDE is getting mixed up between the code you see and something else - perhaps an older version.

I suggest that you try to compile the code for a different Arduino board - try a Mega if you are using an Uno. This forces the Arduino to recompile everything from scratch. If that works, then try again after selecting the correct board.

Another option (because the program is very small) might be to create a new sketch and type in the exact same code - and do NOT copy and paste it in case there are some strange non-printing characters hidden in it.

If none of that works I think my next step would be to make copies of any program files you want to keep and then uninstall and reinstall the Arduino IDE.

...R

Robin2: OK. The code in the screen shot doesn't have the lines

  // write current time when led is turned on.
    Serial.println("Led on at: ");

which are in the code in Reply #9. However that small difference should not matter. It should compile without error.

It seems you do have a very strange problem - hence my reluctance to believe it. I wonder if the Arduino IDE is getting mixed up between the code you see and something else - perhaps an older version.

I suggest that you try to compile the code for a different Arduino board - try a Mega if you are using an Uno. This forces the Arduino to recompile everything from scratch. If that works, then try again after selecting the correct board.

Another option (because the program is very small) might be to create a new sketch and type in the exact same code - and do NOT copy and paste it in case there are some strange non-printing characters hidden in it.

If none of that works I think my next step would be to make copies of any program files you want to keep and then uninstall and reinstall the Arduino IDE.

...R

Sorry for delay,

  // write current time when led is turned on.
    Serial.println("Led on at: ");

this code Ive remove becouse it doesnt work. Ive moved my project to windows 7 and everything works OK. I cant understand why, but in ubuntu Ive got a problems.

Many thanks again for your reply.

Regards