Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #15 on: January 27, 2013, 11:14:03 pm » |
 here's what my output is
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14106
Lua rocks!
|
 |
« Reply #16 on: January 27, 2013, 11:16:06 pm » |
I'm confused about what the device is, still. As in, its part number. You don't generally connect things via a single wire. Does the device have a ground wire? Is it wired to the Arduino ground? i don't have a photo or a schematic sir, Do you have a phone with a camera in it? How about using it? here's what my output is I believe you. You don't have to attach a screenshot. You can copy and paste from the output window.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #17 on: January 27, 2013, 11:22:34 pm » |
here's what the device is... i bet it is just newly constructed so got no full ideas about it. http://www.e-gizmo.com/KIT/NEWIR.htmbut i will try all your suggestions now sir...thanks a lot. u guys got my sincere gratitudes 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #18 on: January 27, 2013, 11:31:31 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #19 on: January 28, 2013, 12:10:55 am » |
pinMode(forwardPin, INPUT); digitalWrite(forwardPin, HIGH); // Turn on the pullup resistor. so the new code will be like this? int forwardPin = 12;
void setup() { Serial.begin(9600); pinMode(forwardPin, INPUT); digitalWrite(forwardPin, HIGH); }
void loop() { int forwardState = digitalRead(forwardPin); if (forwardState == HIGH) { Serial.println("HIGH"); delay(1000); } else { Serial.println("LOW"); delay(1000); } }
|
|
|
|
|
Logged
|
|
|
|
|
California
Online
Edison Member
Karma: 51
Posts: 2189
|
 |
« Reply #20 on: January 28, 2013, 12:20:16 am » |
so the new code will be like this?
Why not try it and tell us?
|
|
|
|
|
Logged
|
|
|
|
|
Pittsburgh, PA, USA
Offline
Faraday Member
Karma: 33
Posts: 3019
I only know some basic electricity....
|
 |
« Reply #21 on: January 28, 2013, 01:04:03 am » |
With those 1 second delays you're not going to read more than the fact a signal was sent from the remote and that only by luck.
Try keeping track of what state the pin was last time it was read and only printing when the state changed. Then take the delays out. But fix the wiring first.
|
|
|
|
|
Logged
|
Examples can be found at Learning in the Main Site and at the Playground
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #22 on: January 28, 2013, 12:15:14 pm » |
pinMode(forwardPin, INPUT); digitalWrite(forwardPin, HIGH); // Turn on the pullup resistor. will it also work if i make it a pull down resistor? some like... pinMode(forwardPin, INPUT); digitalWrite(forwardPin, LOW); // Turn on the pulldown resistor
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 143
Posts: 19380
I don't think you connected the grounds, Dave.
|
 |
« Reply #23 on: January 28, 2013, 12:17:31 pm » |
No, there are no built in pulldowns
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #24 on: January 28, 2013, 12:37:14 pm » |
No, there are no built in pulldowns
thanks sir that helped a lot ^^
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14106
Lua rocks!
|
 |
« Reply #25 on: January 28, 2013, 03:27:48 pm » |
pinMode(forwardPin, INPUT); digitalWrite(forwardPin, LOW); // turn off the pull-up resistor
All that second line does is turn off the pull-up. There had to be a way of doing it, and this is it.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #26 on: January 28, 2013, 09:36:16 pm » |
pinMode(forwardPin, INPUT); digitalWrite(forwardPin, LOW); // turn off the pull-up resistor
All that second line does is turn off the pull-up. There had to be a way of doing it, and this is it. oh really sir?! gee thanks! i will try it now
|
|
|
|
|
Logged
|
|
|
|
|
Beijing
Offline
Full Member
Karma: 3
Posts: 181
Skype name habib.derbyshire
|
 |
« Reply #27 on: January 28, 2013, 09:48:42 pm » |
Do you know how to wire a pull-down resistor?
|
|
|
|
|
Logged
|
What is man's best friend? The breadboard!
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #28 on: January 28, 2013, 09:58:07 pm » |
Do you know how to wire a pull-down resistor?
yes sir i read about it
|
|
|
|
|
Logged
|
|
|
|
|
Beijing
Offline
Full Member
Karma: 3
Posts: 181
Skype name habib.derbyshire
|
 |
« Reply #29 on: January 28, 2013, 10:22:55 pm » |
|
|
|
|
|
Logged
|
What is man's best friend? The breadboard!
|
|
|
|
|