Programm to run/stop arduino

Hello all !

Firstly excuse-me for my bad english :smiley:

I have a arduino nano and a compass who are coonnected at arduino with i²c bus...
My program is to get 3 information from my compass, i've etablished the program and the connection to the PC with tx & Rx.

My programm is running with no problem (it give me 3 informations every 500ms like : 31 65 -13 /n 56 47 09.......

Now i want to control the run/stop of my arduino from my computer...
For example if i send "STOP" arduino stop running, if o send "RUN" arduino start running or an other solution but a solution to control the running from my computer and not with a external PIN...

Can you help me please ? is for a project to my university and i have to finish the project if i want to get my school year :~

Thanks,

For example if i send "STOP" arduino stop running,

It isn't normally possible to stop an Arduino running, and if you did, it would not be capable of accepting a command to start it running!

Tell us what you want to achieve.

Thanks for your repply,

i want just to control when arduino send me information, because when i give a voltage of 5v to my arduino ( when i'm powering ), it always send me information...i d'ont want this, i want to control the "start sending" and "stop sending", it's impossible ?? :blush:

Thx

You can open and close the serial port in the pc, or just stop listening to it..

No, it isn't impossible, but actually stopping and starting the Arduino is (or at least it is difficult).
Just set/reset a flag based on your input, then test he flag before you print anything.
Have a look at "Serial.available".

Senso:
You can open and close the serial port in the pc, or just stop listening to it..

Disabling the reset would be a must in most of these situations... :wink:

Thanks a lot....but i can't just close the port com to stop listenning...

Because the UART connection is between 2 bluetooth module ( Bluegiga WT11 bluetooth device who are connected at the arduino and a Usb dongle connected at my computer.
The problem is when i want to connect my Computer to the bluetooth device, i can't because a lot of informations from the arduino go to the WT11 bluetooth device and it's impossible to etablich a connection to this WT11 when this WT11 receive uart signals....

So, if i want to connect the WT11 to my computer i have to pushing the reset button of my arduino during the connection, and when the connection are etablish i can drop the reset button and i receive my data without any problem...

it's for this reasons i want to control the start/stop of my arduino...

Have you got any other solutions ?

Thanks,

but i can't just close the port com to stop listenning...

I never suggested closing any ports.
My solution should take around six lines of code.

It's not for you AWOL :

Senso:
You can open and close the serial port in the pc, or just stop listening to it..

What is your solution with a code ?

See reply #4