Text with digital pins

Store Forums Video Experimenter Bugs/Problems Text with digital pins

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #748
    jbolfiil
    Member

    I am trying to display text based on that status of a couple of digital pins… I am having more trouble than I thought I would have. How do you check the digital pin?


    if(digitalRead(pinNumber))
    {
    tv.print(50, 50, "text");
    }
    else
    {
    tv.print(50, 50, "something else");
    }

    I have tried this but the there is no change in the text when I tie 5V or ground to that pin. Yes, I am also doing “pinMode(pinNumber, INPUT)” in the void Setup(). I have looked up the information on digital pins on the Arduino website a lot but I still can’t understand…
    What am I doing wrong?

    Also, what is a good base code to start with? I downloaded some of the project but I don’t know what is necessary and not necessary with the registers, timers, etc.

    Like I said, all I want to do is to display minimal, non-moving text depending on the digital pins so any help regarding that is appreciated!

    #2158
    Michael
    Keymaster

    Initialize with:

    pinMode(pinNumber, INPUT_PULLUP);

    This will tie the pin to 5V with a pullup resistor. To activate ground the pin and it will read LOW.

    read with:

    if (digitalRead(pinNumber) == HIGH) {
    tv.print(50, 50, "text");
    } else {
    tv.print(50, 50, "something else");
    }
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.