Turn on/off LED when activating some program/software on PC.

Hi everyone,

I want to build a simple software notification with arduino uno.
The scenario is, when I open microsoft word, particular led (blue) will turning on. when I close the program then led will turn off. Or when I open microsoft power point, Led (orange) will turn on, and so on.

Is it possible? if yes, what should I do? what library I'll need?

please help.... :confused:

Waiting for your good feedback. Any help is appreciated! :slight_smile:
Thank you so much.

Is it possible?

Yes. You can have a process that simply monitors other processes. When the appropriate process appears, send a message, via the serial port, to the Arduino. When the appropriate process disappears, send a different message.

if yes, what should I do?

Develop the application.

what library I'll need?

The Stepper library.

PaulS:
The Stepper library.

I presume that was a joke.

@faziefazie, most of what you need to do (and the most complex part) must be done by a program running on your PC that can detect what other programs are running.

Once you have developed a PC program that can do that it will be relatively simple to extend it to send messages to an Arduino to turn lights on or off.

Developing the PC program is outside the scope of the Arduino Forum.

...R

I presume that was a joke.

Stupid questions deserve stupid answers. Libraries for what?

is a joke really

you do not need no library only know DOS command

open notepad

open cmd and run this command

TASKLIST /FI "imagename eq notepad.exe" /svc

then create a script (save code below in a file FindNotepad.cmd on desktop )

1 set serial comunication
2 execute command and store line in variable
save printed line in var1, var2, var3
and send var3 to COM9

SETLOCAL ENABLEDELAYEDEXPANSION

mode COM9 BAUD=9600 PARITY=n DATA=8

SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (`TASKLIST /FI "imagename eq notepad.exe" /svc`) DO (
  SET var!count!=%%F
  SET /a count=!count!+1
)

ECHO %var3% >\\.\COM9 
ENDLOCAL

then use the serial event example in arduino mixed with String compare example

String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete

void setup() {
  // initialize serial:
  Serial.begin(9600);
  delay(1000);
  // reserve 250 bytes for the inputString:
  inputString.reserve(250);
  pinMode(13, OUTPUT);
}

void loop() {
  
  serialEvent(); //call the function
  // print the string when a newline arrives:
  if (stringComplete) {
    // two strings equal:
    String TestString = "notepad.exe";
    if ( TestString == inputString.substring(0, 11) ) {
      digitalWrite(13, HIGH);
      delay(2000);
      digitalWrite(13, LOW);
    }
    // clear the string:
    inputString = "";
    stringComplete = false;
  }
}

/*
  SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
 */
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

doubleclick FindNotepad.cmd

led13 on arduino light for 2 sec

PaulS:
Stupid questions deserve stupid answers. Libraries for what?

Hi,
I know I'm that STUPID to ask these question. That's why I need SMART people like you.
Don't be so rude to people like me who want to learn more. if you don't really want to answer those stupid question then don't be offensive like that.

dataino:
is a joke really

you do not need no library only know DOS command

Microsoft DOS and Windows Command Line

open notepad

open cmd and run this command

TASKLIST /FI "imagename eq notepad.exe" /svc

then create a script (save code below in a file FindNotepad.cmd on desktop )

1 set serial comunication
2 execute command and store line in variable
save printed line in var1, var2, var3
and send var3 to COM9

Hi,

Thank you so much for the feedback. it's really the best solution for me.
But once I follow your instructions, I little bit confused with these instruction :

  1. execute command and store line in variable
    save printed line in var1, var2, var3
    and send var3 to COM9

this is should be change in arduino code?

because when I didn't change anything from your code, when I click FindNotepad.cmd the arduino LED Rx blink 2s, instead of LED pin 13.

please correct me if I'm wrong.

Don't be so rude to people like me who want to learn more.

It was premature of you to be asking about what libraries would be needed. You haven't a clue what you are going to do. It would have made sense to wait until you had a clue to ask specific questions about how to do it.

So, don't expect polite treatment until you ask intelligent questions. And that means asking the question at the right time as much as it means asking the right question.

Maybe this is an example of the two major problems with foruns today. The first is the "ask first, read later" philosophy, the second is the trolling, even if isn't the intention.

The fist step to solve this two problems is to read, read a lot. First you need to understand the tools you are dealing with, learning the capabilities of the tool (Arduino is a tool not a end in itself), how to make it do what you wan't it to do, the lingo (words used in a specific way) of the community, etc.

If you study first and ask questions later probably most your first questions will be gone!

Can you (faziefazie) see what is you first error? Lingo... Libraries in Arduino lingo are "packs of commands" to make Arduino programming easier, to save time and lines of command: what is the logic in reinventing the wheel???

You asked for libraries... There is lots of shields to do the arduino recieve commands of a computer via a lot of channels (USB, Ethernet, Wi-Fi), and probably there is a librarie for all these shields, but you put the "cart before the horse", and this situations usually irritate the older members for a simple reason: shows that somebody want to do something without read about it first.

The second problem coul'd be solved with a little thinking before typing. Ok, the question was "stupid", but if you, PaulIS, answer with in a constructive manner, maybe the newbie will understand his error and stop questioning "stupid" questions!

You are here since 2008 and have more than 63k posts, probably with a lot of arduino knoledge and a vast forum knoledge too! I'm the newbiest of all the newbie, but I'm seeing this kind of "conflict" in any forum that I go, and maybe because of my age this kind of situation in witch nobody gains nothing is starting to irritate em a loooot, keeping me off of foruns with lots of potential knoledge share, but with less than good forum dynamics.

And for the faziefazie, be aware that probably isn't good to read that your question are "stupid", but aways try to read between the lines. If you think a little you will see that or you can't express what was your doubt or really don't understand what you need to do what you are trying to do, the need for a software to send arduino a command, etc.

Ok, for my first post it was long, boring and even off topic... Let's call a day!

And sorry for my english, I'm brazilian and read a lot, but don't write in english very often.

Moccelin:
And for the faziefazie, be aware that probably isn't good to read that your question are "stupid", but aways try to read between the lines. If you think a little you will see that or you can't express what was your doubt or really don't understand what you need to do what you are trying to do, the need for a software to send arduino a

Very wise.

Your English is a lot better than my non-existent Brazilian/Portuguese.

...R
PS Welcome to the Forum.