Announcement

Collapse
No announcement yet.

Too many Winbuttons ???

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Too many Winbuttons ???

    Hey everyone,
    I wanted to use this Display (uLCD-43PT-AR) to build a little "Homeautomation" with arduino.
    That means the Display should act as two IR-Remote Controles (TV and soundsystem) and one 434MHz transmitter for
    a wireless power socket system (sry I'm from germany and I'm not sure if it is named like this in english).
    Both functions (IR Transmitter and 434MHz Transmitter) are working but when i put it together it doesn't work.
    Is it possible that i have too much winbuttons in my project (about 26 or so).
    I hope someone can help me :D
    Thanks alot for everyone
    Attached Files

  • #2
    Hello,

    I have looked through your code and it looks ok. The amount of buttons is fine. Would you say the arduino was failing or the display was failing?. I have also had a look at the libraries used. The IRemote library uses timer1, It may be the use of that timer affecting the serial.

    Best regards

    Paul.

    Comment


    • #3
      what do you mean "put it together"?

      does the code work if you use one, or the other in genie
      or
      does the code work without genie?

      posting your priject zip from workshop may help us find issues if you have communication issues with genie

      Comment


      • #4
        I tried the code that i posted above, but i deleted some of the winbutton statements till it worked fine.
        With only 17 statements it worked great (IR and 434MHz) but if I put in 18 statements it doesn't work anymore it seems that the runtime is to high or something like that
        Attached Files

        Comment


        • #5
          yes it may be related to the hardware timer used by the irlibrary like paul said, I would also recommend removing the 100ms delay timer from those events as they are only triggered once anyways, and it will be able to regain access to the doevents loop faster, which, may make it work as well. you'd need to try it, the delays could be the culprit
          what microprocessor do you have?
          Last edited by tonton81; 21st June 2017, 03:41 AM.

          Comment


          • #6
            i use an arduino uno with an atmega 328p-pu

            Comment


            • #7
              deleting the delays had no affect, but sometimes it works (just as i said above it looks like the runtime of the sketch is to long )

              Comment


              • #8
                you may also try to edit the boarddefs with the timer changed to try it again, look for the code:

                Code:
                 
                // Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc
                // ATmega48, ATmega88, ATmega168, ATmega328
                //#define IR_USE_TIMER1 // tx = pin 9
                #define IR_USE_TIMER2 // tx = pin 3
                #endif
                timer2 is used by default, again, maybe it could also be caused by the delays

                make sure you have enough memory for the remote data arrays, try to put them as const in globals so the AVR puts it in program space instead of ram
                evert time you reload those arrays in the event handler, the memory usage goes up and down and possibly crashes the MCU
                defining them as const will store them in progmem like so:

                Code:
                 const unsigned int TVPOWER[68]  = {4500, 4450, 600, 1650, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 550, 550, 550, 600, 500, 600, 1650, 600, 1600, 650, 1600, 600, 500, 600, 550, 550, 550, 600, 500, 600, 550, 600, 500, 600, 1650, 600, 500, 550, 550, 600, 500, 650, 500, 600, 500, 600, 550, 600, 1600, 600, 500, 600, 1650, 600, 1600, 650, 1600, 600, 1650, 600, 1600, 600, 1650, 600};
                 const unsigned int TVHDMI[68]   = {4500, 4450, 600, 1600, 650, 1650, 550, 1650, 600, 500, 600, 550, 550, 550, 600, 500, 600, 550, 550, 1650, 600, 1650, 550, 1700, 550, 550, 550, 550, 600, 550, 550, 550, 550, 550, 600, 1650, 550, 1650, 600, 550, 550, 1650, 600, 550, 550, 550, 550, 550, 600, 1600, 600, 550, 600, 500, 600, 1650, 550, 550, 600, 1650, 550, 1650, 600, 1650, 600, 500, 600};
                 const unsigned int TVSOURCE[68] = {4550, 4400, 650, 1600, 600, 1650, 600, 1600, 600, 550, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 1650, 600, 1650, 600, 500, 600, 500, 600, 550, 600, 500, 600, 500, 600, 1650, 600, 500, 600, 500, 600, 550, 600, 500, 600, 500, 600, 550, 600, 500, 600, 500, 600, 1650, 600, 1600, 650, 1600, 600, 1650, 600, 1600, 600, 1650, 600, 1600, 600};
                 const unsigned int TVPROGUP[68] = {4550, 4400, 600, 1650, 600, 1600, 600, 1600, 600, 550, 600, 500, 600, 550, 550, 600, 550, 500, 600, 1650, 600, 1650, 600, 1600, 600, 550, 600, 500, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1650, 550, 550, 600, 500, 600, 1650, 600, 500, 600, 500, 600, 550, 550, 1650, 600, 500, 600, 1650, 600, 1650, 600, 500, 600, 1650, 550, 1650, 600, 1650, 600};
                 const unsigned int TVPROGDWN[68] = {4550, 4400, 600, 1650, 600, 1600, 600, 1600, 600, 550, 600, 500, 600, 550, 550, 600, 550, 500, 600, 1650, 600, 1650, 600, 1600, 600, 550, 600, 500, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1650, 550, 550, 600, 500, 600, 1650, 600, 500, 600, 500, 600, 550, 550, 1650, 600, 500, 600, 1650, 600, 1650, 600, 500, 600, 1650, 550, 1650, 600, 1650, 600};
                 const unsigned int TVVOLUP[68]  = {4500, 4450, 600, 1650, 600, 1600, 600, 1650, 600, 550, 600, 500, 550, 550, 600, 500, 600, 550, 550, 1650, 600, 1650, 550, 1700, 550, 550, 550, 550, 600, 500, 600, 550, 550, 550, 600, 1650, 550, 1650, 600, 1650, 550, 550, 600, 500, 600, 550, 550, 550, 600, 500, 600, 550, 550, 550, 600, 500, 600, 1650, 600, 1650, 600, 1600, 600, 1650, 600, 1600, 600};
                 const unsigned int TVVOLDWN[68] = {4550, 4400, 600, 1650, 600, 1650, 600, 1600, 600, 500, 600, 550, 600, 550, 550, 550, 550, 550, 600, 1650, 550, 1650, 600, 1650, 550, 550, 600, 550, 550, 550, 550, 550, 600, 550, 550, 1650, 600, 1650, 550, 550, 600, 1650, 550, 550, 550, 550, 600, 550, 550, 550, 550, 550, 600, 550, 550, 1650, 600, 500, 600, 1650, 600, 1650, 550, 1650, 600, 1650, 550};
                 const unsigned int TVGUIDE[68]  = {4550, 4400, 600, 1650, 600, 1650, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 600, 550, 600, 1600, 600, 1650, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1650, 600, 1600, 600, 1650, 550, 1650, 600, 550, 600, 500, 600, 1600, 600, 550, 600, 500, 600, 550, 550, 550, 550, 550, 600, 1650, 550, 1650, 600, 550, 550, 1650, 600};
                 const unsigned int TVARRUP[68]  = {4550, 4400, 600, 1650, 600, 1650, 550, 1650, 600, 550, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 1650, 600, 1650, 550, 550, 600, 500, 600, 550, 600, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 600, 550, 600, 1600, 600, 1650, 600, 500, 600, 1650, 550, 1650, 600, 1650, 600, 1600, 600, 1650, 600, 500, 650, 500, 600, 1600, 600};
                 const unsigned int TVARRDWN[68] = {4550, 4450, 600, 1600, 650, 1600, 600, 1650, 600, 500, 600, 500, 650, 500, 600, 500, 600, 500, 650, 1600, 600, 1650, 600, 1600, 600, 500, 650, 500, 600, 500, 600, 500, 650, 500, 600, 1600, 600, 550, 600, 500, 600, 500, 600, 550, 600, 1600, 600, 1650, 600, 500, 600, 500, 650, 1600, 600, 1600, 650, 1600, 600, 1650, 600, 500, 600, 500, 650, 1600, 600};
                 const unsigned int TVARRLF[68]  = {4550, 4450, 600, 1650, 550, 1650, 600, 1650, 550, 550, 600, 550, 600, 500, 550, 550, 600, 550, 550, 1650, 600, 1600, 600, 1650, 600, 550, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 500, 650, 1600, 600, 550, 600, 500, 600, 1650, 600, 1600, 600, 550, 600, 500, 600, 1600, 600, 550, 600, 1600, 600, 1650, 600, 500, 600, 550, 600, 1600, 600};
                 const unsigned int TVARRRI[68]  = {4550, 4400, 650, 1600, 650, 1600, 600, 1650, 600, 500, 600, 500, 600, 550, 550, 550, 550, 550, 600, 1650, 550, 1650, 600, 1650, 600, 500, 600, 550, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1650, 600, 500, 550, 550, 600, 500, 650, 1600, 600, 1650, 600, 500, 600, 1600, 650, 500, 600, 1600, 650, 1600, 600, 1650, 600, 500, 600, 500, 600, 1600, 650};
                 const unsigned int TVENTER[68]  = {4550, 4400, 650, 1650, 550, 1650, 600, 1650, 550, 550, 600, 500, 600, 550, 550, 550, 600, 500, 600, 1650, 550, 1650, 600, 1650, 600, 550, 550, 550, 550, 550, 600, 500, 600, 500, 600, 550, 600, 500, 600, 550, 550, 1650, 600, 550, 550, 1650, 600, 1650, 550, 550, 600, 1650, 550, 1650, 600, 1650, 550, 550, 600, 1650, 550, 550, 600, 500, 600, 1650, 600};
                
                  //Yamaha Stereo
                 const unsigned int STEREOPOWER[68]  = {8900, 4400, 650, 1600, 600, 1650, 600, 1650, 600, 1600, 600, 1650, 600, 1600, 600, 1650, 600, 500, 600, 1650, 600, 500, 600, 550, 600, 500, 600, 500, 600, 550, 600, 500, 600, 500, 600, 500, 600, 550, 600, 500, 600, 500, 650, 1600, 600, 500, 600, 1650, 600, 500, 600, 1650, 600, 1650, 600, 1600, 600, 1600, 650, 500, 600, 1650, 600, 500, 600, 1650, 600};
                 const unsigned int STEREOPC[68]     = {8950, 4400, 650, 500, 600, 1600, 650, 450, 650, 1600, 650, 1600, 600, 1600, 650, 1600, 600, 500, 650, 1600, 600, 500, 650, 1600, 600, 500, 650, 450, 650, 500, 600, 500, 650, 1600, 600, 500, 650, 1600, 600, 500, 650, 1550, 650, 500, 600, 500, 650, 1600, 650, 450, 650, 1600, 650, 450, 650, 1600, 600, 500, 650, 1600, 600, 1600, 650, 500, 600, 500, 650};
                 const unsigned int STEREOTV[68]     = {8950, 4400, 650, 400, 700, 1600, 650, 450, 650, 1600, 650, 1600, 600, 1600, 650, 1600, 600, 500, 650, 1600, 600, 500, 650, 1550, 650, 500, 600, 500, 650, 500, 600, 500, 600, 1650, 600, 1600, 650, 1550, 650, 500, 650, 500, 600, 500, 600, 500, 650, 500, 600, 500, 650, 450, 650, 500, 600, 1600, 650, 1600, 600, 1600, 650, 1600, 650, 1600, 600, 500, 650};
                 const unsigned int STEREOBLURAY[68] = {8950, 4350, 650, 500, 650, 1600, 600, 500, 650, 1600, 600, 1600, 650, 1600, 650, 1600, 600, 500, 650, 1600, 600, 500, 600, 1600, 650, 500, 600, 500, 650, 450, 650, 500, 600, 1600, 650, 500, 600, 500, 650, 450, 650, 500, 600, 500, 650, 450, 650, 500, 600, 500, 650, 1600, 600, 1600, 650, 1600, 650, 1600, 600, 1600, 650, 1600, 600, 1600, 650, 500, 600};
                 const unsigned int STEREOVOLUP[68]  = {8950, 4350, 650, 500, 650, 1600, 600, 500, 650, 1600, 600, 1600, 650, 1600, 650, 1600, 600, 500, 650, 1600, 600, 450, 650, 1600, 650, 500, 600, 500, 650, 450, 650, 500, 600, 1600, 650, 500, 600, 1600, 650, 500, 600, 1600, 650, 1600, 650, 500, 600, 500, 600, 500, 650, 1600, 600, 500, 650, 1600, 600, 500, 650, 450, 650, 1600, 650, 1600, 600, 1600, 650};
                 const unsigned int STEREOVOLDWN[68] = {8950, 4400, 600, 500, 600, 1650, 600, 500, 600, 1650, 600, 1650, 600, 1600, 650, 1600, 600, 500, 650, 1600, 600, 500, 600, 1650, 600, 500, 600, 500, 650, 500, 600, 500, 600, 1600, 650, 1600, 650, 1600, 600, 500, 650, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 650, 500, 600, 500, 600, 1650, 600, 500, 600, 500, 650, 1600, 600, 1600, 650, 1600, 650};
                 const unsigned int STEREOMUTE[68]   = {8950, 4350, 650, 500, 650, 1600, 600, 500, 650, 1600, 600, 1600, 650, 1550, 650, 1650, 600, 500, 600, 1600, 650, 500, 600, 1600, 650, 500, 600, 500, 650, 450, 650, 500, 600, 1600, 650, 500, 600, 500, 650, 1600, 600, 1600, 650, 1600, 650, 450, 650, 500, 600, 500, 650, 1600, 600, 1600, 650, 500, 600, 500, 650, 500, 600, 1600, 600, 1650, 600, 1600, 650};
                put them in globals. your uno will be happier not taxing it's memory
                Last edited by tonton81; 21st June 2017, 03:59 AM.

                Comment


                • #9
                  they are to big for globals (not enough memory on the uno) your code withe timer2 made an failure because of the end if at the end
                  sry for beeing a bit unknown :D

                  Comment


                  • #10
                    Hello,

                    yes, I agree moving the data array's out of the loop to be as const's would help. They are being redefined every time which takes time as it is quite a lot of data.

                    Best regards

                    Paul

                    Comment


                    • #11
                      hansbeda, no they dont use memory when defined as const, everytime they are used it's read from flash storage of the 328, NOT the memory

                      Comment


                      • #12
                        i dont have enough ram for all these globals thats the point why i put them on local

                        Comment


                        • #13
                          I just loded the sketch up on my mega and now it works fine yesterday it wont work on the mega too ok thanks a lot guys i think i just work with the arduino mega

                          Comment


                          • #14
                            Hello,

                            Looking through the list of codes in the array, the first 2 numbers are definately going to have to be 16 bit numbers but the remainder of the value's in the array are all divisible by 10 and when divided they are all below 255. It would be possible to make these array's as uint8_t or byte saving about half the ram usage if you still wanted to use the Uno. the first 2 values would have to be split into MSB and LSB for both and would have to reconstructed to an int in the loop. and the other values multiplied by 10 in the loop.

                            I hope that makes sense.

                            Best regards

                            Paul

                            Comment


                            • #15
                              its global but only written to flash, uses 0% ram, thats what const is for, when your code goes to use it, it reads it from the flash, where your sketch is, uses no memory at all as its not stored in ram

                              Comment

                              Working...
                              X