Get help from AI-powered GUI-O Assistant! Open Assistant
  • Looking for BLE example for UNO R4 WFi

    Wishlist
    2
    0 Votes
    2 Posts
    10 Views
    K

    @al1fch Hi,

    try the code below (install the latest ArduinoBLE library through Library Manager).

    /* * GUI-O Basic BLE example for Arduino UNO R4 WiFi * * Uses the ArduinoBLE library and Nordic UART Service (NUS) UUIDs. * * Connect an LED (with a suitable series resistor) to PWM pin D9. * The onboard LED is not used because brightness control requires PWM. * * SPDX-License-Identifier: BSD-3-Clause */ #include <ArduinoBLE.h> namespace led { constexpr uint8_t PIN = 9; // UNO R4 WiFi PWM-capable pin } namespace uuid { constexpr char SERVICE[] = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E"; constexpr char RX[] = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E"; constexpr char TX[] = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E"; } namespace ble { // A 20-byte payload works without depending on a larger negotiated MTU. constexpr size_t NOTIFY_CHUNK_SIZE = 20; constexpr int RX_BUFFER_SIZE = 512; } void parseGuioMsg(const String &msg); void sendMsg(const String &msg); BLEService nusService(uuid::SERVICE); // GUI-O writes commands to RX. BLECharacteristic rxCharacteristic( uuid::RX, BLEWrite | BLEWriteWithoutResponse, ble::RX_BUFFER_SIZE ); // UNO R4 sends GUI commands through TX notifications. BLECharacteristic txCharacteristic( uuid::TX, BLENotify, ble::NOTIFY_CHUNK_SIZE ); bool wasConnected = false; void setup() { Serial.begin(115200); pinMode(led::PIN, OUTPUT); analogWrite(led::PIN, 0); if (!BLE.begin()) { Serial.println("Failed to initialize BLE!"); while (true) { delay(1000); } } BLE.setLocalName("BasicBLE_NUS"); BLE.setDeviceName("BasicBLE_NUS"); BLE.setAdvertisedService(nusService); nusService.addCharacteristic(rxCharacteristic); nusService.addCharacteristic(txCharacteristic); BLE.addService(nusService); BLE.advertise(); Serial.println("BLE advertising started."); } void loop() { BLE.poll(); BLEDevice central = BLE.central(); const bool connected = central && central.connected(); if (connected && !wasConnected) { Serial.print("Connected to: "); Serial.println(central.address()); wasConnected = true; } if (!connected && wasConnected) { Serial.println("Disconnected!"); wasConnected = false; // Explicitly resume advertising for reliable reconnection. BLE.advertise(); } if (connected && rxCharacteristic.written()) { const int length = rxCharacteristic.valueLength(); if (length > 0) { String msg; msg.reserve(length); const uint8_t *value = rxCharacteristic.value(); for (int i = 0; i < length; ++i) { msg += static_cast<char>(value[i]); } parseGuioMsg(msg); } } } /***************************/ /* IMPLEMENT YOUR GUI HERE */ /***************************/ void sendMsg(const String &msg) { if (!wasConnected) { return; } const uint8_t *data = reinterpret_cast<const uint8_t *>(msg.c_str()); size_t remaining = msg.length(); while (remaining > 0) { const size_t chunkLength = remaining > ble::NOTIFY_CHUNK_SIZE ? ble::NOTIFY_CHUNK_SIZE : remaining; if (!txCharacteristic.writeValue(data, chunkLength)) { Serial.println("Failed to send BLE notification."); return; } data += chunkLength; remaining -= chunkLength; BLE.poll(); delay(10); } } void parseGuioMsg(const String &msg) { if (msg.startsWith("@init")) { Serial.println("GUI-O app is requesting INITIALIZATION!"); // Clear screen and set background. sendMsg("@cls\r\n"); sendMsg("@guis BGC:#FFFFFF\r\n"); delay(100); // Initialize simple example GUI. sendMsg("|LB UID:title X:50 Y:15 TXT:\"Simple light switch\" FFA:\"font8\" FSZ:3.5\r\n"); sendMsg("|LB UID:tap_me X:50 Y:70 TXT:\"TAP ME!\" FFA:\"font8\" FSZ:3 FFA:\"font5\"\r\n"); sendMsg("|CB UID:brightness X:50 Y:50 W:90 BTH:5 HAH:8 HAW:8 VIS:0 STA:135 ENA:45 FGC:#000000 SFGC:#FFFF00 BGC:#CBCBCB\r\n"); sendMsg("|IM UID:light_off X:50 Y:50 IP:\"https://i.imgur.com/3VbsS0Z.png\" VIS:1\r\n"); sendMsg("|IM UID:light_on X:50 Y:50 IP:\"https://i.imgur.com/gNdck9A.png\" VIS:0\r\n"); } else if (msg.startsWith("@light_off")) { Serial.println("GUI-O app is requesting LIGHT ON!"); sendMsg("@light_off VIS:0\r\n"); sendMsg("@light_on VIS:1\r\n"); sendMsg("@brightness VIS:1 VAL:100\r\n"); analogWrite(led::PIN, 255); } else if (msg.startsWith("@light_on")) { Serial.println("GUI-O app is requesting LIGHT OFF!"); sendMsg("@light_off VIS:1\r\n"); sendMsg("@light_on VIS:0\r\n"); sendMsg("@brightness VIS:0 VAL:0\r\n"); analogWrite(led::PIN, 0); } else if (msg.startsWith("@brightness")) { const int idx = msg.indexOf(' '); if (idx > 0) { const int val = msg.substring(idx + 1).toInt(); if (val >= 0 && val <= 100) { Serial.print("GUI-O app is requesting LIGHT BRIGHTNESS: "); Serial.println(val); const int pwmValue = map(val, 0, 100, 0, 255); analogWrite(led::PIN, pwmValue); } } } }

    I just used Chat to port the code from ESP32 on the GUI-O website. Should work...

    Best regards,
    Kl3m3n

  • GUI-O power amplifier remote control

    Share Your Projects
    1
    0 Votes
    1 Posts
    112 Views
    No one has replied
  • Graphique commands

    General Discussion
    4
    0 Votes
    4 Posts
    239 Views
    B

    @kl3m3n
    It's OK, thank you !! perfect the IA ! Bernard

  • Landscape/portrait

    General Discussion
    3
    0 Votes
    3 Posts
    167 Views
    B

    @kl3m3n
    Already tested, it's work fine. Thank you !! Bernard

  • AI-powered GUI-O assistant

    Pinned Announcements
    1
    0 Votes
    1 Posts
    184 Views
    No one has replied
  • 0 Votes
    5 Posts
    456 Views
    K

    @gammda

    The issue is .au.
    Try just bobstantonx@gmail.com

    Regards.

  • an experiment with AI

    Share Your Projects
    2
    0 Votes
    2 Posts
    313 Views
    K

    @Bernard That is great! 🙂

    I also use AI for various tasks. It is incredibly useful, but in my opinion it is only a tool and should be treated as such.

    Kl3m3n

  • User password

    General Discussion
    5
    0 Votes
    5 Posts
    385 Views
    K

    @Bernard Hi!

    Currently, no, it is not possible.
    I will see if i can make a "toggle visibility" option for the next release.

    Kl3m3n

  • |SORI command

    General Discussion
    2
    0 Votes
    2 Posts
    176 Views
    K

    @Bernard Hi.

    Strange, this command works for me... You are terminating the command with new line, i.e. '\n'?

    Can you try sending @sori1 ORI:2\r\n after creating the component?

    Kl3m3n

  • ESP8266 & Arduino & GUI-O automatic pairing

    General Discussion
    5
    0 Votes
    5 Posts
    371 Views
    B

    @kl3m3n
    Thank you for answering my questions, I have reinstalled GUI-O Bernard

  • Iot Settings

    General Discussion
    2
    0 Votes
    2 Posts
    205 Views
    K

    @Bernard Hi.

    You can do one of the following:

    Clear the app data from Android settings (settings - apps - GUI-O - clear all data). Note that this will clear everything, even stored devices.

    Follow this link on GUI-O website:
    https://www.gui-o.com/examples/gui-o-and-boards/esp32#h.7e5a31l59xj
    Download the example and check the credentials in the code near the top. You can use port 8883 for secure communication, or 1883 otherwise. Client id can be empty, in this case GUI-O selects a unique generic client. You can also set it to your unique username.

    Best regards,
    Kl3m3n

  • TI keyboard covers my input

    Report Bugs
    15
    0 Votes
    15 Posts
    1k Views
    K

    @RudiP Hi.

    I am fairly positive that settings are not the cause of this.

    Can you first try changing the keyboard? I assume that your default keyboard is Samsung keyboard. Try changing it to Gboard (should be something like Android settings -> Additional settings -> Language and input).

    Best regards,
    Kl3m3n

  • Connection error

    General Discussion
    4
    0 Votes
    4 Posts
    342 Views
    K

    @Bernard No problem!

    I am glad it works now.

    Regards.

  • 0 Votes
    6 Posts
    643 Views
  • 0 Votes
    2 Posts
    231 Views
    K

    @mile_hi_guy Thanks for posting this. I have put this on my "issues" list.

    Best regards.

  • Ability to add comments to Live Design tool command list

    Wishlist
    7
    0 Votes
    7 Posts
    808 Views
    K

    @mile_hi_guy

    Fixed, v0.0.20. Also added the comments to the selection view.
    I made some minor changes and you will need to update your comments.

    Best regards,
    Kl3m3n

  • 0 Votes
    4 Posts
    558 Views
    K

    @mile_hi_guy Thanks for pointing this out!

    Best regards,
    Kl3m3n

  • 0 Votes
    6 Posts
    721 Views
    K

    @Vladì Hi,

    version v1.0.110 now supports setting the default orientation. You can set it via the settings menu:
    General settings -> Display settings -> Default screen orientation.

    Best regards,
    Kl3m3n

  • 0 Votes
    3 Posts
    327 Views
    M

    Thanks, I look forward to the fix.

    My design if fairly complex. It sure would be helpful to be able to add comments to the box 2 command list. It seems to me adding a "comment widget" object would be a fairly elegant and simple way to enable this. The comment lines could then be displayed in box 2 and the GUI-O command string box. The comments would then be stripped out when sent to the GIO-O app.

  • 0 Votes
    4 Posts
    371 Views
    K

    @mile_hi_guy No problem.

    I will try to make it more explicit in the next update (e.g., adding some meaningful text to "Connection lost because device stopped responding")...

    I will also think about adding this feature to the designer app.

    Thanks for the feedback.

    Best regards,
    Kl3m3n