GUI-O Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    GUI-O Arduino Joystick

    Scheduled Pinned Locked Moved
    Share Your Projects
    1
    1
    423
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gammda
      last edited by gammda

      Here is a very simple example how a GUI-O joystick can be made on Arduino Leonardo Nano hardware and used on an Android phone.
      It could be also good alternative for LCD displays.

      Instruction in 5 steps:

      1. Prepare hardware, see schematic.jpg
      Schematic.JPG

      2. Install the GUI-O from
      https://www.gui-o.com]
      https://play.google.com/store/apps/details?id=com.guio.guioapp]
      on your smartphone

      3. Open MS-Leonardof.ino
      and program the Arduino Leonardo.

      4. Open GUI-O on smartphone, connect with Bluetooth device (HC06)

      5. Press the start button in the GUI-O application
      (blue circle with the GUI-O symbol)

      That's it.

      Youtube video

      Screenshot_20211125-193055.jpg

      //-----------------------------------------------------------------------
      // Arduino Leonardo nano Joystic Bluetooth HC06
      // GUI-O JOYSTIC 
      // https://play.google.com/store/apps/details?id=com.guio.guioapp
      // www.gui-o.com
      //-----------------------------------------------------------------------
      float xa = 0.095419;
      float yb = 0.048638;
      
      float x;
      float y;
      
      byte bt1;
      byte cur;
      
      //Setup-------------------------------------------------------------------
      void setup()
      {
      
       Serial1.begin(9600);
       while (!Serial1); //wait for connection to become live
        delay(1000);
      //GUI-O Init
      init_guio();
      
      pinMode(21, INPUT_PULLUP);
      }
      
      //Main -------------------------------------------------------------------
      void loop()
      {
       joystick();
       
       while (Serial1.available() > 0 ) {
      
           String str = Serial1.readString();
      
           if (str.equals("@im1 1\r\n")) {
      
              init_guio();
           } 
      
           if (str.equals("@init\r\n")) {
              init_guio();
           } 
      }
      }
      
      // Procedure Init GUI-O --------------------------------------------------------
      void init_guio()
      {
      //GUI-O Init
      
      Serial1.println("@sls 500");
      Serial1.println("@cls");
      Serial1.println("@clo");
      Serial1.println("@gse COD:0 TSC:39");
      Serial1.println("@guis BGC:#696969 ASR:0.449671");
      
      Serial1. println("|BSR UID:bsr1 X:50 Y:25 W:99 H:50 VIS:1 ROT:0 RAD:1.5 BGC:#d3d3d3 SBGC:#d3d3d3 FGC:#d3d3d3 SHE:1 BTH:0.5");
      Serial1.println("|LB UID:lb2 X:80 Y:48 ALP:0 SHE:1 ROT:0 URL:1 FGC:#FFFFFF FSZ:2 FFA:'font0' TXT:'www.gui-o.com'");
      Serial1.println("|SI UID:six X:50 Y:25 W:5 VIS:1 ROT:0 BGC:#B0C4DE FGC:#FF0000 SHE:1 EN:0");
      Serial1.println("|LB UID:lb0 X:50 Y:55 ALP:0 SHE:1 ROT:0 FGC:#FFFFFF FSZ:4 FFA:'font7' TXT:'GUI-O Joystick'");
      Serial1.println("|LB UID:lb1 X:50 Y:63 ALP:0 SHE:1 ROT:0 FGC:#FFFFFF FSZ:3 FFA:'font7' TXT:'Arduino Leonardo'");
      
      Serial1.println("|LB UID:lbcu X:50 Y:60 ALP:0 SHE:1 ROT:0 FGC:#000000 FSZ:1.8 FFA:'font0' TXT:'---'");
      
      Serial1.println("|IM UID:im1 X:50 Y:80 W:60 H:60 ROT:0 SHVR:0.8 SHE:1 SHC:#404040 IP:'https://i.imgur.com/sG1LpQV.png'");
      
      Serial1.println("|IM UID:imp X:50 Y:25 W:15 H:10 ROT:0 SHVR:0.8 SHE:0 SHC:#404040 IP:'https://i.imgur.com/tlDfn0k.png'");
      Serial1.println("@hls 200");
      
      }
      // Joystick----------------------------------------------------------------------
      // Porcedure Joystick
      void joystick()
      {
         x=analogRead(A1)*xa;
         y=analogRead(A0)*yb;
         cur=y+4;
      
        bt1=(!digitalRead(21));
        digitalWrite(5, bt1);
      
        delay(10);
      
        Serial1.print("@six X:");Serial1.print(x);Serial1.print(" Y:"); Serial1.print(y); Serial1.print(" EN:");Serial1.print(bt1);
        Serial1.println();
      
         Serial1.print("@imp X:");Serial1.print(x);Serial1.print(" Y:"); Serial1.print(y);
         Serial1.println();
      
        Serial1.print("@lbcu X:");Serial1.print(x);Serial1.print(" Y:"); Serial1.print(cur); Serial1.print(" TXT:'");
        Serial1.print("X:"); Serial1.print(x); Serial1.print("Y:"); Serial1.print(y);Serial1.print("'");
      
        Serial1.println();
      }  
      
      //---------------------------------------------------------------------------------
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post