Sketch startup led

Hi,

I am triggering a pc on-off by a rf remote.I placed my arduino sketch at startup menu at that pc.But sometimes it doesn't start up or there is a problem with remote.So when there is a problem, I have to go near remote pc.So I thought that if a led blinks on and off for one second when the sketch is on,and when I turned the pc another led blinks from another pin.

Any suggestions?

I have no clue what you just asked. Could you please restate the question, clearer.

thereyouare:
Hi,

I am triggering a pc on-off by a rf remote.I placed my arduino sketch at startup menu at that pc.But sometimes it doesn't start up or there is a problem with remote.So when there is a problem, I have to go near remote pc.So I thought that if a led blinks on and off for one second when the sketch is on,and when I turned the pc another led blinks from another pin.

Any suggestions?

Yes very confusing on what and how you are doing this. An arduino board plugged into the USB port, if it already has a sketch loaded into it, does not need any software in the PC to start it up. Once the PC's USB port has +5vdc power on it the arduino board will start running it's sketch code. Perhaps if you posted the arduino's sketch code here we could see at least what it is trying to perform.

Lefty

OK.I will try to be more clear.

I am running an arduino sketch on a remote computer.I am turning this computer on by a radio frequency controlled relay.It often works but occasionaly it doesn't turn the computer on.When it doesn't,I assume that it(so the arduino) is running and that takes time for understand me the arduino isn't running.So I wanted to be sure that the sketch is running by observing the led connected to an output pin.It will blink on and off for just a second.

Sorry you are right.It is an application that interacts with the sketch .

This is arduino sketch source code:

// SerialMouse sketch
const int buttonPin = 2; //LOW on digital pin enables mouse
const int potXPin = 4; // analog pins for pots
const int potYPin = 5;
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH); // turn on pull-ups
}
void loop()
{
int x = (512 - analogRead(potXPin)) / 4; // range is -127 to +127
int y = (512 - analogRead(potYPin)) / 4;
Serial.print("Data,");
Serial.print(x,DEC);
Serial.print(",");
Serial.print(y,DEC);
Serial.print(",");
if(digitalRead(buttonPin) == LOW)
Serial.print(1); // send 1 when button pressed
else
Serial.print(0);
Serial.println(",");
delay(50); // send position 20 times a second
}

This one is processing sketch source code:

// Processing Sketch
/*

  • ArduinoMouse.pde (Processing sketch)/
    /
    WARNING: This sketch takes over your mouse

Press escape to close running sketch /
import java.awt.AWTException;
import java.awt.Robot;
import processing.serial.
;
Serial myPort; // Create object from Serial class
arduMouse myMouse; // create arduino controlled mouse
public static final short LF = 10; // ASCII linefeed
public static final short portIndex = 1; // select the com port,
// 0 is the first port
int posX, posY, btn; // data from msg fields will be stored here
void setup() {
size(200, 200);
println(Serial.list());
println(" Connecting to -> " + Serial.list()[portIndex]);
myPort = new Serial(this,Serial.list()[portIndex], 9600);
myMouse = new arduMouse();
btn = 0; // turn mouse off until requested by Arduino message
}
void draw() {
if ( btn != 0)
myMouse.move(posX, posY); // move mouse to received x and y position
}
void serialEvent(Serial p) {
String message = myPort.readStringUntil(LF); // read serial data
if(message != null)
{
//print(message);
String [] data = message.split(","); // Split the comma-separated message
if ( data[0].equals("Data"))// check for data header
{
if( data.length > 3 )
{
try {
posX = Integer.parseInt(data[1]);
posY = Integer.parseInt(data[2]);
btn = Integer.parseInt(data[3]);
}
catch (Throwable t) {
println("."); // parse error
print(message);
}
}
}
}
}
class arduMouse {
Robot myRobot; // create object from Robot class;
static final short rate = 4; // multiplier to adjust movement rate
int centerX, centerY;
arduMouse() {
try {
myRobot = new Robot();
}
catch (AWTException e) {
e.printStackTrace();
}
Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
centerY = (int)screen.getHeight() / 2 ;
centerX = (int)screen.getWidth() / 2;
}
// method to move mouse from center of screen by given offset
void move(int offsetX, int offsetY) {
myRobot.mouseMove(centerX + (rate* offsetX), centerY - (rate * offsetY));
}
}
Both of them are from arduino cookbook 2nd.I am almost using the same codes.

ok so now the next question is, does the arduino run on its own power or from the computer? Im safe to assume that it is running on its own power supply right?

I am running an arduino sketch on a remote computer. I am turning this computer on by a radio frequency controlled relay.It often works but occasionaly it doesn't turn the computer on.

Where is the relay wired to exactly?

Arduino is powered by computer via usb.Relay has its own unit and no relation with arduino.The relay unit just turns on the computer.

Arduino is powered by computer via usb.Relay has its own unit and no relation with arduino.The relay unit just turns on the computer.

Soooo, the arduino is being powered by the same computer you want to turn on and off?

Off, I can understand, but if the computer is OFF then how will it turn back ON if the arduino has no power?

HazardsMind:

Arduino is powered by computer via usb.Relay has its own unit and no relation with arduino.The relay unit just turns on the computer.

Soooo, the arduino is being powered by the same computer you want to turn on and off?

Off, I can understand, but if the computer is OFF then how will it turn back ON if the arduino has no power?

By the remote control key fob he has in his hand that will power up the PC which then powers up the Arduino. The problem he is seeing is not with the arduino directly but rather getting his PC software application working correctly with the arduino sketch when first powering up the whole system via remote control. At least that is my reading of the situation. The arduino has nothing to do with powering the PC on or off (or itself for that matter :smiley: ) That is handled by an independent remote controlled relay module.

Lefty

Oh, ok, my mistake.

Yes,Lefty.The situation is the same what you have told.Never mind the relay and the others.My fault.I am just clearing my question.I want a led to blink on for just a second from one of output pins when I start the above processing application from the computer.Is it possible?