0
\$\begingroup\$

i started to build an infrared transmitter (commander). I use 4 pushbuttons for left, right, up, down. These buttons are pulling down when pressed. I used internal pullup resistors. My prboblem is that the arduino is seeing one pin as high (not changeable by pressing button) and the other pins as low (not changeable by pressing buttons). It is not recognizing the changes.

I tried the following to solve:

  • First i used Pulldowns and the result was the same. Then i searched for an alternative and found pullupp. The same Problem.
  • I tried other pins. Same Problem.
  • Checked the soldering connections. Everything is OK.
  • Then i measured the voltages for the first pin. When nothing is pressed the voltage between pin A0 and Ground is 0V and when pressed the voltage between pin A0 and Ground is 0V.
  • I took external resistor (1k) instead of internal pullup. Know the probelm with the single one is solved. The voltages when pressed and not pressed are OK. But the controller pins are not recognizing the changes.

The last point is very strange i expected 5V when not pressed and 0V when pressed.

Here is my code:

    #include <IRremote.h>
    #include <IRremoteInt.h>

    IRsend irsend;

    // The configuration of the output pin will be made by the library
    // The output pin is a different one for different arduinos
    // Arduino UNO:  Output = D3
    // Arduino MEGA: Output = D9
    // You will find a full list of output pins on the website:
    // http://z3t0.github.io/Arduino-IRremote/


    #define TASTE_HOCH 19       //A0
    #define TASTE_RECHTS 22     //A3
    #define TASTE_UNTEN 21      //A2
    #define TASTE_LINKS 20      //A1

    int aktiveTaste = 0;        //Taste die momentan gedrückt ist

    void setup()
    {
    pinMode(TASTE_HOCH, INPUT_PULLUP);     
    pinMode(TASTE_RECHTS, INPUT_PULLUP);   
    pinMode(TASTE_UNTEN, INPUT_PULLUP);   
    pinMode(TASTE_LINKS, INPUT_PULLUP);    

    Serial.begin(9600);
    }

    // main program loop
    void loop() {


    Serial.print("TASTE_HOCH: ");
    Serial.println(digitalRead(TASTE_HOCH), DEC);

    Serial.print("TASTE_RECHTS: ");
    Serial.println(digitalRead(TASTE_RECHTS), DEC);

    Serial.print("TASTE_UNTEN: ");
    Serial.println(digitalRead(TASTE_UNTEN), DEC);

    Serial.print("TASTE_LINKS: ");
    Serial.println(digitalRead(TASTE_LINKS), DEC);

    delay(3000);

    if(digitalRead(TASTE_HOCH) == LOW){
       aktiveTaste = 1;
    }
    else if(digitalRead(TASTE_RECHTS) == LOW){
       aktiveTaste = 2;
    }
    else if(digitalRead(TASTE_UNTEN) == LOW){
       aktiveTaste = 3;
    }
    else if(digitalRead(TASTE_LINKS) == LOW){
       aktiveTaste = 4;
    }



    if(aktiveTaste > 0){
    
    
    // The transmitter sends in this example the signal A90 (hex. dezimal   form) in the encoding "RC5"
    // It will be transmitted 3 times after that it will make a 5 second break
    for (int i = 0; i < 3; i++) {
      irsend.sendRC5(aktiveTaste, 12); // [0xA90] signal | [12] Bit-length signal (hex A90=1010 1001 0000)
      delay(40);
    }

    aktiveTaste = 0;                    //Keine Taste gedrückt
    }
    }

And This is the output of serial print:

enter image description here

What is the cause for not recognizing changes?

\$\endgroup\$
2
  • \$\begingroup\$ I don't own a nano, but if I'm not mistaken there's a mismatch between the pin numbers of your code and the actual pinout: pighixxx.com/test/pinouts/boards/nano.pdf 19 is A5 actually etc. Can you post photos / schematic of the actual wiring? \$\endgroup\$
    – idkfa
    Apr 11 '18 at 10:40
  • \$\begingroup\$ The numbers are diffrent. I used a picture from the internet. This is the link: google.de/…: \$\endgroup\$ Apr 11 '18 at 10:44
2
\$\begingroup\$

i solved my problem. After the comment from idfka I realised that the pins of the nano boards are manufacturer specific. My board is this one: https://www.google.de/search?q=arduino+nano+pins&client=firefox-b&dcr=0&tbm=isch&source=iu&ictx=1&fir=g5a8iQQg303lcM%253A%252Ctmj5jJzH5Ig2qM%252C_&usg=__72_pjW6IJT1IOYTAo5yM4-X_zkA%3D&sa=X&ved=0ahUKEwiIlKX7hbLaAhXBJVAKHWHxC_EQ9QEILjAB#imgrc=uEf4hxPbfX8vZM:

Before that i used the numbers for the pins from this one: https://www.google.de/search?q=arduino+nano+pins&client=firefox-b&dcr=0&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiIlKX7hbLaAhXBJVAKHWHxC_EQ_AUICygC&biw=1920&bih=954#imgrc=AJV5mxdwaZYG6M:

And this is from idkfa: http://www.pighixxx.com/test/pinouts/boards/nano.pdf

I never thought that different manufacuters will use different pins.

#define TASTE_HOCH 14       //A0
#define TASTE_RECHTS 17     //A3
#define TASTE_UNTEN 16      //A2
#define TASTE_LINKS 15      //A1

The change of the numbers solved my problem.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Your first two links just google images results, but don't indicate any specific image. \$\endgroup\$
    – Bort
    Apr 11 '18 at 11:34
  • 2
    \$\begingroup\$ Also FYI: Links go dead or the content can change. It's best to at least include a short summary of your link content. In your case, they are images. You can attach images with the image button, or by pressing CTRL+G. It supports copy and paste or click and drag. \$\endgroup\$
    – Bort
    Apr 11 '18 at 11:40
  • \$\begingroup\$ I know. But are they not copyright prtected. Can i just copy them to this space? \$\endgroup\$ Apr 11 '18 at 18:25
  • \$\begingroup\$ I'm not sure what issue you are having. Why can't you put the image in your answer? \$\endgroup\$
    – Bort
    Apr 11 '18 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.