38kHz TSOP read for remote on A. Uno

Discussion in 'Microcontrollers and Programming' started by wingnut, Jan 9, 2017.

  1. wingnut

    wingnut

    Joined:
    Aug 9, 2012
    Messages:
    225
    Likes Received:
    7
    Location:
    South Africa
    Dear All

    I am writing a C program on the Arduino Uno to make it into a universal remote where it can read an IR signal from some TV remote and then play this back via an IR LED.

    This worked fine on a PIC690 in Mikrobasic where I used these lines...

    while portA.2 = 1
    wend

    This worked fine to loop/wait indefinitely for the TV remote to be pressed so the signal could be copied.

    The same on the Uno becomes....

    while (digitalRead(2) == 1) { }

    Here is the problem. Even though I have a pullup resistor of 1k5 on digital pin 2 (actually pin 4 of the Atmega328),
    the above line of C does not stop/loop infinitely because, for some reason, pin2 goes to zero occasionally and does not wait for me to press the TV remote so it can copy it. I even removed the TSOP from digital pin 2 so there is no other input on that pin, and it still did not halt the program from continuing. In the setup I wrote.... pinMode(2, INPUT); to ready it for the read.

    Any suggestions would be welcomed. Thanks
     
    wingnut, Jan 9, 2017
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob Business
    Replies:
    1
    Views:
    1,286
    Anand Dhuru
    Nov 19, 2003
  2. flashbiter@gmx.net

    Help on infrared remote control, 38khz quarz

    flashbiter@gmx.net, Nov 28, 2005, in forum: Electronic Design
    Replies:
    19
    Views:
    1,870
    Bob Monsen
    Dec 2, 2005
  3. jls667
    Replies:
    3
    Views:
    246
    duke37
    Sep 15, 2016
  4. woodylepic
    Replies:
    6
    Views:
    101
    woodylepic
    Nov 8, 2016
  5. Nwanno Promise
    Replies:
    2
    Views:
    113
    (*steve*)
    Nov 23, 2016
  6. andy taylor
    Replies:
    13
    Views:
    137
    davenn
    Dec 31, 2016
  7. Electric Al
    Replies:
    6
    Views:
    122
    Audioguru
    Jan 5, 2017
  8. MadeleineRS
    Replies:
    26
    Views:
    256
    garublador
    Jan 20, 2017
Loading...