<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Arduino &amp; ESP32 - Basic USB]]></title><description><![CDATA[<hr />
<p dir="auto"><strong>GUI-O + Arduino + ESP32</strong></p>
<p dir="auto">Developer manual: <a href="https://www.gui-o.com/assets/gui-o_developer_manual.pdf" rel="nofollow ugc">https://www.gui-o.com/assets/gui-o_developer_manual.pdf</a></p>
<hr />
<p dir="auto"></p><div class="video-embed"><iframe allowfullscreen src="//www.youtube.com/embed/UrnvwgLIWOo"></iframe></div><p></p>
<p dir="auto">A DEMO project to help you quickly get started with GUI-O and USB using Esp32 board. You can expand the example for your specific project.</p>
<p dir="auto">Download BasicUSB.ino sketch from:<br />
<a href="https://drive.google.com/file/d/1IvShiEMM2jK9O2V9xGfT7XTkV95Iwk6m/view?usp=sharing" rel="nofollow ugc">https://drive.google.com/file/d/1IvShiEMM2jK9O2V9xGfT7XTkV95Iwk6m/view?usp=sharing</a></p>
<p dir="auto">Additional Boards Manager URLs:<br />
<a href="https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" rel="nofollow ugc">https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json</a></p>
<pre><code>/*
 * GUI-O Basic USB example 
 *
 * Copyright (C) 2021, GUI-O Team
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

namespace led {
  static const uint8_t LED_BUILTIN = 2;
  static const uint8_t LED_CHANNEL = 0;
  static const double LED_FREQ = 5000.0;
  static const uint8_t LED_BITS = 8;
} // namespace led

// forward declare parser for incoming messages
void parseGuioMsg(const String &amp;msg);

// icoming data buffer
String in;

void setup() {
  // setup serial
  Serial.begin(115200);

  // setup builtin led
  ledcSetup(led::LED_CHANNEL, led::LED_FREQ, led::LED_BITS); // channel, freq, resolution_bits
  ledcAttachPin(led::LED_BUILTIN, led::LED_CHANNEL);
}

void loop() {
  while(Serial.available()) {
    const char c = Serial.read();
    in += c;
  
    if(c == '\n') {
      // parse message string
      parseGuioMsg(in);
      // clear buffer
      in = "";
    }  
  }
}

/***************************/
/* IMPLEMENT YOUR GUI HERE */
/***************************/
void parseGuioMsg(const String &amp;msg) {
  if(msg.startsWith("@init")) {
    // clear screen and set background
    Serial.print("@cls\r\n");
    Serial.print("@guis BGC:#FFFFFF\r\n");
    delay(100);

    // initialize simple example GUI
    Serial.print("|LB UID:title X:50 Y:15 TXT:\"Simple light switch\" FFA:\"font8\" FSZ:3.5\r\n");
    Serial.print("|LB UID:tap_me X:50 Y:70 TXT:\"TAP ME!\" FFA:\"font8\" FSZ:3 FFA:\"font5\"\r\n");
    Serial.print("|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");
    Serial.print("|IM UID:light_off X:50 Y:50 IP:\"https://i.imgur.com/3VbsS0Z.png\" VIS:1\r\n");
    Serial.print("|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")) {
    // "drive GUI-O app"
    Serial.print("@light_off VIS:0\r\n");
    Serial.print("@light_on VIS:1\r\n");
    Serial.print("@brightness VIS:1 VAL:100\r\n");

    // led enable
    ledcWrite(led::LED_CHANNEL, 255);
  }
  else if(msg.startsWith("@light_on")) {
    // "drive GUI-O app"
    Serial.print("@light_off VIS:1\r\n");
    Serial.print("@light_on VIS:0\r\n");
    Serial.print("@brightness VIS:0 VAL:0\r\n");

    // led disable
    ledcWrite(led::LED_CHANNEL, 0);
  }
  else if(msg.startsWith("@brightness")) {
    const int idx = msg.indexOf(' ');
    
    if(idx &gt; 0) {
      const int val = msg.substring(idx + 1).toInt();
      
      if(val &gt;= 0 &amp;&amp; val &lt;= 100) {
        // led drive
        ledcWrite(led::LED_CHANNEL, static_cast&lt;uint8_t&gt;(val * 2.55));
      }            
    }    
  }  
}
</code></pre>
]]></description><link>https://forum.gui-o.com/topic/21/arduino-esp32-basic-usb</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 05:20:03 GMT</lastBuildDate><atom:link href="https://forum.gui-o.com/topic/21.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Aug 2021 21:51:30 GMT</pubDate><ttl>60</ttl></channel></rss>