Announcement

Collapse
No announcement yet.

Dimmer Function?

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

  • Dimmer Function?

    I want to do two things related to dimming:

    1. I want to be able to read the current Contrast and allow the user to adjust the contrast up and down between 1 and 16 - but how do I read the current Contrast value? gfx_setContrast does not equate to gfx_getContrast...

    2. I want to have an auto-dimming feature, so has anyone programmed a photo diode that puts out a voltage that is read by the uOLED and used to automatically set the Contrast?

    Any suggestions greatly appreciated!

    P.S. The 4DGL docs refer me to the uOLED-128-F2 Datasheet for instructions on how to set the contrast to something besides ON and OFF, but there is no reference to an external data table in the Datasheet anywhere, and searching all of the sample code for "dim" or "contrast" results in no hits. Same for the forums.

  • #2


    1. There is no way to read contrast, you will have to use a variable to store it and read and set from that variable.

    2. The datasheet in section 4.2 shows how to connect and LDR

    Regarding the docs, which one? I'm looking in the Goldelox internal functions ref and it seems to be pretty clear in there.
    Mark

    Comment


    • #3


      Thanks very much for your response, much appreciated! I'm glad there's someone participating in these forums, or I think my project would be doomed or horribly delayed. I'm learning a lot with this project, and I appreciate the pointers you provide.

      I have the contrast working, and for some reason now it's as simple as calling gfx_Contrast(0-16). WTH?!?

      When I posted originally, that function was not working, and I thought (from the documentation) that I needed to set some kind of register table that was supposed to be included in the Datasheet - but there is no such table in the Datasheet, and after messing with it for quite a while, it just started working with gfx_Contrast(x), so I'm leaving it alone!

      My confusion stemmed from the 4DGL Internal Functions Reference Manual, which states that gfx_Contrast(0-16) "is only available on Goldelox Engineering samples, must be implemented in users code for GOLDELOX-GFX2 with external initialisation tables, refer to individual display driver data sheets)".

      I did notice the LDR in the manual last night, thanks for the reference! Now I need to figure out how to do both things at once - e.g. I need to get button input (on IO1), and I need to sense ambient light (on IO1)... Hmmm...

      Is there any way to do either of those things on IO2 instead? Is there such a things as a digital button array, or a digital light sensor?

      Comment


      • #4


        "is only available on Goldelox Engineering samples, must be implemented in users code for GOLDELOX-GFX2 with external initialisation tables, refer to individual display driver data sheets)".At the time that was written there were the 3 OLEDs which had customised PmmCs available ("Goldelox Engineering samples") and it was envisaged that people would buy the goldelox proprocessor and create their own initialization tables and use the generic PmmC ("GOLDELOX-GFX2").

        Whilst that is still pretty much valid not that many people have gone down the custom route. Also the uLCD-144 does not have adjustable backlight (as don't most small LCD displays).

        Is there any way to do either of those things on IO2 instead?
        Have a look at the table under the pin_Set command, it describes what you can do on what pins.
        Mark

        Comment


        • #5


          Yeah, I thought so, that means I'm pretty much hosed.

          Comment


          • #6


            Huh? Why?
            Mark

            Comment


            • #7


              IO2 won't do the button array OR the LDR, so unless I figure out how to do what I need with an Arduino and send commands or updates over the serial RX/TX pins, I don't have enough IO on the display board.

              Comment


              • #8


                Ah right, thought you just needed a single button.
                Mark

                Comment


                • #9


                  No worries, thanks for the replies - I appreciate the help.

                  Is it possible to hook up the button array to an Arduino instead, and somehow send "Button 1/2/3/4 was pressed" commands over serial?

                  If I know it's possible I'll start digging in that direction.

                  Comment


                  • #10


                    Button array works by reading an analogue value and selecting the button depending on the range.

                    If you have a space analogue bit on the Arduino you should be able to do that.

                    Sending a serial value to the Display should be fairly straight forwards.
                    Mark

                    Comment


                    • #11


                      I see using the library I can send all the standard gfx_XXXXX commands and what-not... is there a standard way to communicate directly from the Arduino program to the 4DGL program? Or should I just stuff a command down the wire and be watching for it on the other end?

                      Comment


                      • #12


                        The Serial library enables you to do that, but I think you are using 'designer' to write your code, err aren't you?

                        So yeah, you can just stuff a command down the wire (Err, that's what I might 'reduce' the whole process to)
                        Mark

                        Comment


                        • #13


                          Thanks for your input! Although I'm writing the display and interface code in 4D, e.g. the code that will operate the "display box", there is also code that will need to run on the Arduino (I assume) and collect data from half a dozen sending units, passing it on to the 4D unit for display.

                          A single 4D will have to be able to display vacuum, boost, oil temperature, supercharger oil temperature, air/fuel ratio, and any number of other elements measured from an engine that is old enough to not be running OBD-II. Each sending unit will be interfaced to an analog pin on the Arduino.

                          If the 4D is running the menus, it will need to be able to tell the Arduino to focus on a particular sender and forward that data, or if the Arduino just monitors all sending units and pushes their data onto a common wire, then the 4D will need to "pick" one sender's data out of all the other senders' data - I haven't quite gotten that far yet.

                          Comment

                          Working...
                          X