Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    New Member
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    4
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Need help radiopanel with RGB Rotary Encoder

    Hi guys,

    Been working on a Radiopanel, inspired, like many of us, by Mr. Jim. 2014-09-19 21.38.35.jpg

    As an addition, I have bought an RGB Led Rotary Encoder. The encoding part is working nicely, but I am getting stuck with the RGB part. It is an common anode RGB. It means it needs 5v in and then the outputs connect to digital pins. I want visual confirmation that the encoder button is pushed. That is, when it is not pushed it is green and when it is pushed, it turns blue. As a stand alone sketch this is not too hard, but to encorporate it in Jim's sketch is another thing.
    Because of the common anode, the wiring is different. Pin 10 is an input and has to be pulled low, at least thats the way it works in the standalone sketch. In Jims sketch it is pulled high. And I have to use pin 0 and pin 1 for the two LED's.

    I think I have the wiring done right. 5v in and switch pin out on 10. Then blue pin on 0 and green pin on 1 (with 220 Ohm) Red unused (Not working, I think I blew that up...)...

    But now the big question, Who can help me rewrite Jim's Sketch.

    Just thought up another question. I have the Saitek switchpanel and multipanel. The radiopanel is going to sit nicely above them. What would be awsome is, that id the avionics switch is off, The radiopanel is also off. Is there a way to program this into the sketch? I think it has something to do with the avionics masterswitchcommand in FSX and the corresponding Link2FS output into Arduino...

    As you can probably tell by now, I am a noob enthousiast, trying to learn from the best...

    Greetings from The Netherlands,

    Wouter

  2. #2
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    764
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Need help radiopanel with RGB Rotary Encoder

    Nice unit you made there Wouter and the addition of the LED's isn't too much of a hassle.

    First ,,, You can not use pins 0 and 1 for anything ,, the serial to USB thingy is also hooked to those pins so because we always use the USB/serial to get the data to the card ,, for our purposes,, we can't use pins 0 and 1.

    That means because you are using an Uno card,, the only pin you have available is pin 13 which at the moment it is connected to GND to stop flutter as an input.

    I take it the common for the LEDs is also connected to the push switch (internally)

    First ,,DISCONNECT all the LED leads that go into the Arduino pins.
    You are correct in feeding the 5 volts into the common bus for the switch and LEDs.
    You are correct in leaving pin 10 as an input to the switch but you need a 10k resistor onto that wire to GND (effectively from pin 10 to GND)
    I would also put this line as the LAST ENTRY in the setup void ,,,,
    digitalWrite(10, LOW);
    That will set pin 10 in the correct starting state.

    The push action may be around the other way so you may want to change all the lines in the INO that say ,,,
    if (digitalRead(10)==0 )
    to be ,,,,
    if (digitalRead(10)==1 )

    With the LED ,, you can only have 1 LED as all we have is 1 spare pin on the Uno.
    Disconnect pin 13 from GND.
    Wire a 220 ohm (or whatever needed to suit the LED) resistor between pin 13 and one of your LED's.

    In the INPUTS void,,
    above the line starting with ,,
    if (pinNo == 11 and pinStateSTR == "0")
    Insert this line,,,
    if (pinNo == 10){if (pinStateSTR == "0"){digitalWrite(13, HIGH);} else {digitalWrite(13, LOW);}}
    (You may have to change the "0" to a "1" )

    So that should get everything going and then we can tackle the other stuff.

    Re. the LCD going blank when the power is off ,, have a look-see at the LCD library functions of "Display()" and "noDisplay()"

    See how you go ,,, Jim
    p.s. Nothing here tested ,, all just "off the cuff"
    Last edited by Jim NZ; 09-20-2014 at 04:58 PM.
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  3. Likes Mikeb1028 liked this post
  4. #3
    New Member
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    4
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Need help radiopanel with RGB Rotary Encoder

    Hello Jim,
    Thank you for your reply. I have a slight set back, as a couple of pins on the rotary encoder broke, so first a new encoder and then a new try. I'll post the results here.

    Wouter

  5. #4
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    764
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Need help radiopanel with RGB Rotary Encoder

    Fine stuff Wouter ,, yes they are easy to bust when they are not on a PCB.

    There was a mistake in my code in that last post (I have edited it) but it should have read,,,
    if (pinNo == 10){if (pinStateSTR == "0"){digitalWrite(13, HIGH);} else {digitalWrite(13, LOW);}}
    so if you have already copied it out then you will have to do it again.

    Cheers ,, Jim
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  6. #5
    New Member
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    4
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Need help radiopanel with RGB Rotary Encoder

    Hey Jim,
    Well, I got my new encoder yesterday, so spend this morning installing it (with a PCB this time, good call!) I changed the code according to your last post.
    When it is done uploading to the UNO, the green light comes on for a sec or so, but then goes off. When I press it, nothing happens.
    So I am a little confused here..
    I included the sketch, cause maybe I did something wrong there...

    I would be very greatfull if you could give it another look.

    Cheers

    Wouter
    Attached Files Attached Files
    Last edited by Woconomi; 09-26-2014 at 07:49 AM. Reason: included file

  7. #6
    25+ Posting Member
    Join Date
    Mar 2014
    Location
    France
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Need help radiopanel with RGB Rotary Encoder

    Hi Wouter,

    I quickly read your sketch and maybe I'm wrong, but I think it's a serial buffer overflow (you receive too many datas)
    Take a look at http://www.jimspage.co.nz/serial_buffer_mod.htm
    To test, simply untick some datas in Jim's Link2fs software (just nav1, nav1sb, dme1 for example) and look what happens
    I don't know if with the new version v6f (about serial data burst) we need to always modify serial buffer (I've not tested yet)

    Ryan

  8. Likes Mikeb1028 liked this post
  9. #7
    New Member
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    4
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Need help radiopanel with RGB Rotary Encoder

    Hi Ryan, thank you for trying to help me out. I've seen Jim's notes on the serial buffer, and adjusted it accordingly. The data from fsx is displayed fine, everything else is working great, except for the led.
    It puzzles me too....

    Wouter

  10. #8
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    764
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Need help radiopanel with RGB Rotary Encoder

    There was a mistake in my code in that last post (I have edited it) but it should have read,,,
    if (pinNo == 10){if (pinStateSTR == "0"){digitalWrite(13, HIGH);} else {digitalWrite(13, LOW);}}

    so if you have already copied it out then you will have to do it again.
    Cheers ,, Jim
    Last edited by Jim NZ; 09-27-2014 at 11:46 PM.
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  11. #9
    25+ Posting Member
    Join Date
    Mar 2014
    Location
    France
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Need help radiopanel with RGB Rotary Encoder

    Hi,
    Jim has pointed the right thing

    in your inputpins() function :

    if (pinNo == 13) ....
    you test logic level of your led pinned to pin 13
    may be
    if (pinNo == 10) ....
    to test your push button pined to pin 10

    Right ?
    ryan

  12. #10
    New Member
    Join Date
    Nov 2013
    Location
    CZ
    Posts
    3
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Need help radiopanel with RGB Rotary Encoder

    Hi Jim, a few days ago I built according to your instructions radiopanel. Programming does not understand and I would like to ask you for help. I WANT position in which it is programmed ADF and DME and NAV2, change the HEADING and ALTITUDE AND SPEED. For example, to change the ADF, the ALTITUDE to the first line was "b =" Altitude set (which will vary Rotary Encoder) and the second line "sekhmet.set@seznam.cz

Page 1 of 2 12 LastLast