Announcement

Collapse
No announcement yet.

GPIO pins change display image

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

  • GPIO pins change display image

    Hi,

    Can the GPIO pins of uLCD-43DT be use to change the images displayed?

    Example:

    If PinInput0 is HIGH - Image0 shows
    If PinInput1 is HIGH - Image1 shows
    If PinInput2 is HIGH - Image2 shows
    and so on.



  • #2
    Hello,

    Yes, that is entirely possible to do.

    Regards
    James

    Comment


    • #3
      Use the pininput object and use it to change the form. Have a separate image on each form.
      Mark

      Comment


      • #4
        Thank you very much for your replies.
        I try it on VISI-Genie as per your suggestions using but didn't work.

        I use the Events of PinInput0 like this "OnChanged: Form1Set" but didn't work. Or am I missing something?
        I'm still new with your software, please bear with me.

        Anyway, I have done it using VISI and some of the examples here in the forum.

        #platform "uLCD-43DT"
        #inherit "4DGL_16bitColours.fnc"
        #inherit "VisualConst.inc"
        #inherit "NoName1Const.inc"

        func pinpressed()
        gfx_MoveTo(10,100) ;
        gfx_RectangleFilled(10,100,300,112,BLACK) ; // clear all pressed messages
        if (!pin_Read(PA4))
        print("PA4 Pressed ") ; // only action on press, no action on release
        img_Show(hndl,iImage1) ;
        endif
        if (!pin_Read(PA5))
        print("PA5 Pressed ") ; // only action on press, no action on release
        img_Show(hndl,iImage2) ;
        endif
        if (!pin_Read(PA6))
        print("PA6 Pressed ") ; // only action on press, no action on release
        endif
        gfx_MoveTo(10,130) ;
        print(pin_Read(PA4)," "); // print pin statuses
        print(pin_Read(PA5)," ");
        print(pin_Read(PA6)," ");
        if ((pin_Read(PA4)==1) && (pin_Read(PA5)==1) && (pin_Read(PA6)==1))
        gfx_Cls();
        endif
        bus_SetChangeInterrupt(pinpressed, M_PA4 | M_PA5 | M_PA6); // rearm interrupt
        endfunc


        func main()
        putstr("Mounting...\n");
        if (!(file_Mount()))
        while(!(file_Mount()))
        putstr("Drive not mounted...");
        pause(200);
        gfx_Cls();
        pause(200);
        wend
        endif
        hndl := file_LoadImageControl("NoName1.dat", "NoName1.gci", 1);
        gfx_Set(SCREEN_MODE,LANDSCAPE) ;
        pin_Set(PIN_INP_HI, PA4);
        pin_Set(PIN_INP_HI, PA5);
        pin_Set(PIN_INP_HI, PA6);
        bus_SetChangeInterrupt(pinpressed, M_PA4 | M_PA5 | M_PA6); // set interrupt on 3 different pin changes
        repeat
        gfx_MoveTo(10,20) ;
        sys_GetTime();
        forever
        endfunc

        Comment


        • #5
          So the ViSi worked? (I didn't really look at it in depth)

          Here's the Genie short and sweet sample I made
          Attached Files
          Mark

          Comment


          • #6
            Yes, the VISI works.
            Thank you very much for your help.

            The file you gave works, I just made the IdleState = High for my application.
            How things are made using your software are incredible, its straight forward and simple.

            I have a lot of questions, and will be posting more threads here.

            Comment

            Working...
            X