Offline
Newbie
Karma: 0
Posts: 6
|
 |
« on: December 04, 2012, 11:33:50 am » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1569
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #1 on: December 04, 2012, 11:37:46 am » |
I have no clue what you just asked. Could you please restate the question, clearer.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #2 on: December 04, 2012, 11:44:34 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #3 on: December 04, 2012, 11:50:07 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #4 on: December 04, 2012, 11:52:03 am » |
Sorry you are right.It is an application that interacts with the sketch .
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #5 on: December 04, 2012, 12:11:38 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1569
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #6 on: December 04, 2012, 12:27:55 pm » |
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?
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #7 on: December 04, 2012, 12:57:43 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1569
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #8 on: December 04, 2012, 01:03:57 pm » |
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?
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #9 on: December 04, 2012, 01:06:54 pm » |
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  ) That is handled by an independent remote controlled relay module. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1569
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #10 on: December 04, 2012, 01:18:22 pm » |
Oh, ok, my mistake.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #11 on: December 04, 2012, 01:53:06 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
|