Serial monitor infinite output

how to do that enabling the pull up resistor? sorry for the question guys T_T thanks

  pinMode(forwardPin, INPUT);
  digitalWrite(forwardPin, HIGH); // Turn on the pullup resistor.

zer0_JuLz:
how to do that enabling the pull up resistor?

If the grounds are not connected then enabling the internal pull ups is not going to help.
You only need to enable the internal pull up if you have an open collector output on your other device.
This is written for power supplies but it applies equally to signals:-
http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

i really appreciate ur help guys...

with regards to connecting grounds, we connected the ground of the supply of our input device to the ground of our arduino... but yet there's also a ground near the outputs of our input device...and i assume the 2 grounds are connected, so we did not connect it

i keep researching about this guys..so, could the pull down resistors be the perfect solution?

Is there a device connected to pin 12? Is it turned on? Is it wired correctly? Perhaps a photo or schematic?

zer0_JuLz:
actually, im using a device which outputs digital signals...and it is connected in pin 12 of my arduino.
(it is an infrared device with a remote as its controller).

A link to the device please.

All this talk about "a device" when you could have specified a part number, and a link to it, is simply wasting time.

i don't have a photo or a schematic sir, but it is an infrared device which is controlled by a remote in which when a corresponding button in the remote is pressed, it has digital output, which is connected to pin 12. my problem is, even though i'm not pressing a button, the serial monitor outputs infinite loop of high and low, which really confuses me if this is a pull down resistor issue.

here's what my output is

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.

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.htm

but i will try all your suggestions now sir...thanks a lot. u guys got my sincere gratitudes :blush:

http://www.e-gizmo.com/KIT/images/11functions/11%20function%20technical%20manual.pdf

found this manual sirs

PaulS:

  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);
  }
}

zer0_JuLz:
so the new code will be like this?

Why not try it and tell us?

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.

PaulS:

  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

No, there are no built in pulldowns

AWOL:
No, there are no built in pulldowns

thanks sir that helped a lot ^^

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