Go Down

Topic: Serial monitor infinite output (Read 2 times) previous topic - next topic

zer0_JuLz


Nick Gammon

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?

Quote
i don't have a photo or a schematic sir,


Do you have a phone with a camera in it? How about using it?

Quote
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.
http://www.gammon.com.au/electronics

zer0_JuLz

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 :smiley-red:

zer0_JuLz

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

found this manual sirs

zer0_JuLz


Code: [Select]
  pinMode(forwardPin, INPUT);
  digitalWrite(forwardPin, HIGH); // Turn on the pullup resistor.




so the new code will be like this?
Code: [Select]
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);
  }
}

Arrch


GoForSmoke

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.

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

zer0_JuLz


Code: [Select]
  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...
Code: [Select]
pinMode(forwardPin, INPUT);
  digitalWrite(forwardPin, LOW); // Turn on the pulldown resistor

AWOL

No, there are no built in pulldowns
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

zer0_JuLz


No, there are no built in pulldowns


thanks sir that helped a lot ^^

Nick Gammon

Code: [Select]

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.
http://www.gammon.com.au/electronics

zer0_JuLz


Code: [Select]

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

arduinohabib

Do you know how to wire a pull-down resistor?
What is man's best friend? The breadboard!

zer0_JuLz


Do you know how to wire a pull-down resistor?


yes sir i read about it

arduinohabib

I'm really not used to someone calling me sir :) :) :) check my profile. Just call me Habib  :)
What is man's best friend? The breadboard!

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview