{"id":9199,"date":"2026-01-29T21:16:04","date_gmt":"2026-01-30T05:16:04","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=9199"},"modified":"2026-01-29T21:16:04","modified_gmt":"2026-01-30T05:16:04","slug":"getting-started-with-ai-edits","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/ai\/quickstart\/","title":{"rendered":"Getting Started with AI Edits"},"content":{"rendered":"<p>This tutorial shows how to quickly try out the AI editing functionality in VisualGDB with a basic project. We will create the basic USB CDC device from template, and will demonstrate some code writing and refactoring.<\/p>\n<p>Before\u00a0 you begin, follow <a href=\"https:\/\/visualgdb.com\/tutorials\/arm\/stm32\/usb\/\">this tutorial<\/a> to create a project for a basic USB device, but don&#8217;t modify the original template yet.<\/p>\n<ol>\n<li>Move the declarations for <strong>VCP_read<\/strong>, <strong>VCP_write,<\/strong> etc to the <strong>usb_cdc_if.h<\/strong> file, so that they match the <strong>usb_cdc_if.c<\/strong> file where they are defined. This will allow the AI to place the new functions in the correct file without explicitly asking it to:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/01-header.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9200\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/01-header.png\" alt=\"\" width=\"1216\" height=\"767\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/01-header.png 1216w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/01-header-300x189.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/01-header-1024x646.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/01-header-768x484.png 768w\" sizes=\"(max-width: 1216px) 100vw, 1216px\" \/><\/a><\/li>\n<li>Go to the main() function and click the AI edit icon:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/02-edit.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9201\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/02-edit.png\" alt=\"\" width=\"1216\" height=\"767\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/02-edit.png 1216w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/02-edit-300x189.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/02-edit-1024x646.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/02-edit-768x484.png 768w\" sizes=\"(max-width: 1216px) 100vw, 1216px\" \/><\/a><\/li>\n<li>Currently<strong>, main()<\/strong> reads the USB input one character at a time. Let&#8217;s change it to read it line-by-line. Write the following prompt:\n<pre>+VCP_ReadLine after read &amp; use it<\/pre>\n<p>Select the GLM model from the list and click &#8220;Go&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/03-prompt.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9202\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/03-prompt.png\" alt=\"\" width=\"1216\" height=\"767\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/03-prompt.png 1216w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/03-prompt-300x189.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/03-prompt-1024x646.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/03-prompt-768x484.png 768w\" sizes=\"(max-width: 1216px) 100vw, 1216px\" \/><\/a><\/li>\n<li>A few seconds later, the model will suggest changing <strong>main()<\/strong> itself, adding a declaration to the header file where <strong>VCP_read()<\/strong> was defined, and also adding the implementation to the .c file, so that the main loop now works line-by-line:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/04-review.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9203\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/04-review.png\" alt=\"\" width=\"1216\" height=\"767\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/04-review.png 1216w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/04-review-300x189.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/04-review-1024x646.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/04-review-768x484.png 768w\" sizes=\"(max-width: 1216px) 100vw, 1216px\" \/><\/a>Smaller models (e.g. Qwen or GPT-OSS-128B) would do it even faster (2-3 seconds), but they normally need a bit more specific prompts (e.g. &#8220;in @usb_cdc_if.c after VCP_read&#8221; rather than just &#8220;after read&#8221;).<\/li>\n<li>Let&#8217;s refine the edit through another prompt:\n<pre>+enum ReadLineFlags (rlCR, rlLF, rlEcho). Pass CR+LF.<\/pre>\n<p><a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/05-flags.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9204\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/05-flags.png\" alt=\"\" width=\"1216\" height=\"767\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/05-flags.png 1216w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/05-flags-300x189.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/05-flags-1024x646.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/05-flags-768x484.png 768w\" sizes=\"(max-width: 1216px) 100vw, 1216px\" \/><\/a>The model very quickly expands it to adding an enum in the correct place, modifying the declaration, body, and calls to <strong>VCP_ReadLine()<\/strong> accordingly.<\/li>\n<li>Now we will show how the automatic reference updating works. Click &#8220;Accept all&#8221; and complete the editing session. Then start another one for VCP_ReadLine() and use this prompt:\n<pre>take maxLen + flags; @malloc , read, return, callers free.<\/pre>\n<p><a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/06-ptr.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9205\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/06-ptr.png\" alt=\"\" width=\"1216\" height=\"767\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/06-ptr.png 1216w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/06-ptr-300x189.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/06-ptr-1024x646.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/06-ptr-768x484.png 768w\" sizes=\"(max-width: 1216px) 100vw, 1216px\" \/><\/a><\/li>\n<li>This was sufficient to change the semantics of VCP_ReadLine(), update declaration, body, and the call in another few seconds:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/07-updated.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9206\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/07-updated.png\" alt=\"\" width=\"1216\" height=\"767\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/07-updated.png 1216w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/07-updated-300x189.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/07-updated-1024x646.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2026\/01\/07-updated-768x484.png 768w\" sizes=\"(max-width: 1216px) 100vw, 1216px\" \/><\/a><\/li>\n<\/ol>\n<p>Unlike the classic AI tools that work on file level, VisualGDB works with individual symbols. Whenever you ask to edit <strong>main()<\/strong> that uses <strong>VCP_read(),<\/strong> VisualGDB automatically pulls it into the context window. If the AI changes the signature of VCP_ReadLine(), VisualGDB detects it and runs another pass with all references. This works really fast and doesn&#8217;t break for large projects with huge files.<\/p>\n<p>If you would like to see more real-world examples, check out our <a href=\"https:\/\/visualgdb.com\/documentation\/ai\/#examples\">tutorial series<\/a> where we used AI to turn an open-source HTTP server for Raspberry Pi Pico into a Web-controlled thermostat.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to quickly try out the AI editing functionality in VisualGDB with a basic project. We will<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[253],"tags":[254,61],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/9199"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=9199"}],"version-history":[{"count":1,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/9199\/revisions"}],"predecessor-version":[{"id":9207,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/9199\/revisions\/9207"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=9199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=9199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=9199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}