<?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[M5Stamp C3 programming examples]]></title><description><![CDATA[<p dir="auto">When will there be M5Stamp C3 programming examples? Interested in turning on the LED in different colors.</p>
]]></description><link>https://community.m5stack.com/topic/3749/m5stamp-c3-programming-examples</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 22:39:25 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/3749.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Nov 2021 09:48:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Sat, 22 Jan 2022 15:32:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a> said in <a href="/post/15687">M5Stamp C3 programming examples</a>:</p>
<blockquote>
<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a></p>
<p dir="auto">What worked for me on macOS Big Sur 11.5.2 is using the <a href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-guides/usb-serial-jtag-console.html" target="_blank" rel="noopener noreferrer nofollow ugc">ESP32C3 built-in USB</a> via GPIO18 and GPIO19.</p>
<p dir="auto">What also worked for me on macOS Big Sur 11.5.2 was downloading and installing this driver CH9102_VCP_SER_MacOS from <a href="https://docs.m5stack.com/en/download" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>. After a reboot and plugging in M5StampC3 via USB this port show up <code>/dev/cu.wchusbserial...</code> (in addition to <code>/dev/cu.usbmodem...</code> which did not work).</p>
<p dir="auto">Thanks<br />
Felix</p>
</blockquote>
<p dir="auto">Hello Felix<br />
read <a href="https://forum.m5stack.com/topic/3760/cant-flash-latest-m5-stamp-c3/21" target="_blank" rel="noopener noreferrer nofollow ugc">here</a> for a possible solution.</p>
]]></description><link>https://community.m5stack.com/post/16304</link><guid isPermaLink="true">https://community.m5stack.com/post/16304</guid><dc:creator><![CDATA[HaSch]]></dc:creator><pubDate>Sat, 22 Jan 2022 15:32:09 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Wed, 01 Dec 2021 22:52:06 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a></p>
<p dir="auto">What worked for me on macOS Big Sur 11.5.2 is using the <a href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-guides/usb-serial-jtag-console.html" target="_blank" rel="noopener noreferrer nofollow ugc">ESP32C3 built-in USB</a> via GPIO18 and GPIO19.</p>
<p dir="auto">What also worked for me on macOS Big Sur 11.5.2 was downloading and installing this driver CH9102_VCP_SER_MacOS from <a href="https://docs.m5stack.com/en/download" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>. After a reboot and plugging in M5StampC3 via USB this port show up <code>/dev/cu.wchusbserial...</code> (in addition to <code>/dev/cu.usbmodem...</code> which did not work).</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/15687</link><guid isPermaLink="true">https://community.m5stack.com/post/15687</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 01 Dec 2021 22:52:06 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Sun, 21 Nov 2021 21:26:47 GMT]]></title><description><![CDATA[<p dir="auto">I have an IDF demo ready but the OSX driver issue is driving me bonkers on Catalina and yet to get the demo uploaded to the C3</p>
]]></description><link>https://community.m5stack.com/post/15556</link><guid isPermaLink="true">https://community.m5stack.com/post/15556</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sun, 21 Nov 2021 21:26:47 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Sun, 21 Nov 2021 20:05:06 GMT]]></title><description><![CDATA[<p dir="auto">I updated <a class="plugin-mentions-user plugin-mentions-a" href="/user/auct" aria-label="Profile: auct">@<bdi>auct</bdi></a>'s code to include the built in button as well:</p>
<pre><code class="language-cpp">#include &lt;Adafruit_NeoPixel.h&gt;

#define BUTTON_PIN 3
#define PIXEL_PIN 2
#define NUM_PIXELS 1

Adafruit_NeoPixel pixel(NUM_PIXELS, PIXEL_PIN, NEO_GRBW + NEO_KHZ400);
bool currentButtonPressed = false;

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

  // set up neopixel
  pixel.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
  pixel.clear(); // Set pixel colors to 'off'
  pixel.show();
  
  // set up GPIO
  pinMode(BUTTON_PIN, INPUT_PULLUP);

  // initial button pressed state
  setPixelToCurrentButtonState();
}

void loop()
{
  // read button state (LOW when pressed)
  bool newButtonPressed = digitalRead(BUTTON_PIN) == LOW;
  setPixelStateIfChanged(newButtonPressed);

  delay(10); // debounce
}

void setPixelStateIfChanged(bool newButtonPressed) {
  if (newButtonPressed != currentButtonPressed) {
    currentButtonPressed = newButtonPressed;
    setPixelToCurrentButtonState();
  }
}

void setPixelToCurrentButtonState() {
  if (currentButtonPressed) {
    Serial.println("turning LED blue");
    pixel.setPixelColor(0, pixel.Color(0, 0, 128));
    pixel.show(); 
  } else {
    Serial.println("turning LED red");
    pixel.setPixelColor(0, pixel.Color(128, 0, 0));
    pixel.show(); 
  }
}
</code></pre>
]]></description><link>https://community.m5stack.com/post/15555</link><guid isPermaLink="true">https://community.m5stack.com/post/15555</guid><dc:creator><![CDATA[trrevvorr]]></dc:creator><pubDate>Sun, 21 Nov 2021 20:05:06 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Sun, 21 Nov 2021 18:49:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/auct" aria-label="Profile: auct">@<bdi>auct</bdi></a> Thank you! After adding the <a href="https://github.com/adafruit/Adafruit_NeoPixel" target="_blank" rel="noopener noreferrer nofollow ugc">Adafruit neopixel library</a> to the arduino IDE, this worked great!</p>
<p dir="auto">I'll also note that I had issues flashing code to the C3 with my Mac (running  OSX Catalina with updated drivers) but using a Windows machine fixed that issue.</p>
]]></description><link>https://community.m5stack.com/post/15553</link><guid isPermaLink="true">https://community.m5stack.com/post/15553</guid><dc:creator><![CDATA[trrevvorr]]></dc:creator><pubDate>Sun, 21 Nov 2021 18:49:54 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Sun, 21 Nov 2021 08:30:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a> Yes confirm. this latest version library works! Here is the blink code<br />
#include &lt;Adafruit_NeoPixel.h&gt;</p>
<p dir="auto">#define PIXELPIN  2<br />
#define NUMPIXELS 1</p>
<p dir="auto">Adafruit_NeoPixel pixel(NUMPIXELS, PIXELPIN, NEO_GRBW + NEO_KHZ400);</p>
<p dir="auto">void setup() {<br />
pixel.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)<br />
pixel.clear(); // Set pixel colors to 'off'<br />
pixel.show();<br />
}</p>
<p dir="auto">void loop() {<br />
pixel.setPixelColor(0, pixel.Color(0, 0, 128));<br />
pixel.show();<br />
delay(1000);</p>
<p dir="auto">pixel.clear();<br />
pixel.show();<br />
delay(500);</p>
<p dir="auto">pixel.setPixelColor(0, pixel.Color(128, 0, 0));<br />
pixel.show();<br />
delay(1000);</p>
<p dir="auto">pixel.clear();<br />
pixel.show();<br />
delay(500);<br />
}</p>
]]></description><link>https://community.m5stack.com/post/15548</link><guid isPermaLink="true">https://community.m5stack.com/post/15548</guid><dc:creator><![CDATA[AucT]]></dc:creator><pubDate>Sun, 21 Nov 2021 08:30:15 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Sat, 20 Nov 2021 20:49:55 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/silentmonkey" aria-label="Profile: silentmonkey">@<bdi>silentmonkey</bdi></a></p>
<p dir="auto">thank you for your idea. Unfortunately the FastLED library doesn't seem to be adapted for the ESP32C3 yet. At least a couple of days ago, when I tried to compile it for the ESP32C3, it wouldn't w/o error.</p>
<p dir="auto">What worked for me instead was the <a href="https://github.com/adafruit/Adafruit_NeoPixel" target="_blank" rel="noopener noreferrer nofollow ugc">Adafruit_NeoPixel</a> library.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/15547</link><guid isPermaLink="true">https://community.m5stack.com/post/15547</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Sat, 20 Nov 2021 20:49:55 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Sat, 20 Nov 2021 20:45:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/silentmonkey" aria-label="Profile: silentmonkey">@<bdi>silentmonkey</bdi></a> said in <a href="/post/15545">M5Stamp C3 programming examples</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/trrevvorr" aria-label="Profile: trrevvorr">@<bdi>trrevvorr</bdi></a> said in <a href="/post/15508">M5Stamp C3 programming examples</a>:</p>
<blockquote>
<p dir="auto">M5Stamp-C3</p>
</blockquote>
<p dir="auto">While I realise it's a different core but I've been having fun with the M5Stamp-Pico which does use the same LED controller so I wonder if this will help with the ops question.</p>
<p dir="auto">I use the Arduino-IDE and the FastLed module. I've attached a snippet of code where the LED is White while searching for the wifi and Green when connected. It then flashes Blue when data is received.</p>
<p dir="auto">More about FastLed can be found here:<br />
<a href="https://github.com/FastLED/FastLED" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/FastLED/FastLED</a><br />
<a href="https://github.com/FastLED/FastLED/wiki/Pixel-reference#chsv" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/FastLED/FastLED/wiki/Pixel-reference#chsv</a></p>
<p dir="auto">// Load Wi-Fi, Servo and Led libraries<br />
#include &lt;WiFi.h&gt;<br />
#include &lt;ESP32Servo.h&gt;<br />
#include &lt;FastLED.h&gt;<br />
#include &lt;Preferences.h&gt;</p>
<p dir="auto">// number of leds on board and data pin<br />
#define NUM_LEDS 1<br />
#define LED_DATA_PIN 27<br />
// Define the array of leds<br />
CRGB leds[NUM_LEDS];</p>
<p dir="auto">//Create Servo Object<br />
Servo servo;</p>
<p dir="auto">// Setup network credentials<br />
const char* ssid     = "SMCS";<br />
const char* password = "**********";</p>
<p dir="auto">// Set web server port number to 80<br />
WiFiServer server(80);</p>
<p dir="auto">// Variable to store the HTTP request<br />
String header;</p>
<p dir="auto">// Auxiliar variables to store the current output state<br />
String SliderValue = "0";         // Contains returned value of Speed Slider range 0-1023<br />
int Speed = 180;                  // Contains Integer value of Speed Slider range 0-180 deg for Servo<br />
int OldSpeed = 180;               // Contains previous speed<br />
int Index;                        // String index</p>
<p dir="auto">unsigned long time_now = 0;       // Used to calculate time outs<br />
String EngineName = "Millie";     // Engine name</p>
<p dir="auto">// Assign output variables to GPIO pins</p>
<p dir="auto">// M5 Stamp pin to GPIO Mapping used by Train Controller<br />
// 5v   positive 5 volt supply<br />
// Gnd  Ground Supply<br />
// G32   GPI32  Servo Pin</p>
<p dir="auto">const int ServoPin = G32;  // Servo Drive GPI32</p>
<p dir="auto">// Current time<br />
unsigned long currentTime = millis();<br />
// Previous time<br />
unsigned long previousTime = 0;<br />
// Define timeout time in milliseconds (example: 2000ms = 2s)<br />
const long timeoutTime = 2000;</p>
<p dir="auto">// Set-up<br />
void setup() {</p>
<p dir="auto">// Initialize the output variables as outputs<br />
// Start with motor Drive control<br />
servo.attach(ServoPin);</p>
<p dir="auto">// Start the serial monitor<br />
Serial.begin(115200);</p>
<p dir="auto">// Set up Fastled and turn it To White<br />
FastLED.addLeds&lt;SK6812, LED_DATA_PIN, GRB&gt;(leds, NUM_LEDS);<br />
leds[0] = CRGB::White;<br />
FastLED.show();</p>
<p dir="auto">// Connect to Wi-Fi network with SSID and password<br />
Serial.print("Connecting to ");<br />
Serial.println(ssid);<br />
WiFi.begin(ssid, password);<br />
while (WiFi.status() != WL_CONNECTED) {<br />
delay(500);<br />
Serial.print(".");<br />
}<br />
// Print local IP address and start web server<br />
leds[0] = CRGB::Green;<br />
FastLED.show();<br />
Serial.println("");<br />
Serial.println("WiFi connected.");<br />
Serial.println("IP address: ");<br />
Serial.println(WiFi.localIP());<br />
server.begin();</p>
<p dir="auto">}</p>
<p dir="auto">// Main program<br />
void loop() {<br />
WiFiClient client = server.available();             // Listen for incoming clients<br />
if (client) {                                       // If a new client connects,<br />
leds[0] = CRGB::Blue;			      // Go Blue<br />
FastLED.show();<br />
Serial.println("New Client.");        // print a message out in the serial port<br />
String currentLine = "";              // make a String to hold incoming data from the client</p>
</blockquote>
<p dir="auto">Thank you for the demo but alas the Pico and C3 are two different chips. The Pico runs on Tensilica cores while the C3 runs on a RISCV core.</p>
]]></description><link>https://community.m5stack.com/post/15546</link><guid isPermaLink="true">https://community.m5stack.com/post/15546</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sat, 20 Nov 2021 20:45:50 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Sat, 20 Nov 2021 19:56:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/trrevvorr" aria-label="Profile: trrevvorr">@<bdi>trrevvorr</bdi></a> said in <a href="/post/15508">M5Stamp C3 programming examples</a>:</p>
<blockquote>
<p dir="auto">M5Stamp-C3</p>
</blockquote>
<p dir="auto">While I realise it's a different core but I've been having fun with the M5Stamp-Pico which does use the same LED controller so I wonder if this will help with the ops question.</p>
<p dir="auto">I use the Arduino-IDE and the FastLed module. I've attached a snippet of code where the LED is White while searching for the wifi and Green when connected. It then flashes Blue when data is received.</p>
<p dir="auto">More about FastLed can be found here:<br />
<a href="https://github.com/FastLED/FastLED" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/FastLED/FastLED</a><br />
<a href="https://github.com/FastLED/FastLED/wiki/Pixel-reference#chsv" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/FastLED/FastLED/wiki/Pixel-reference#chsv</a></p>
<p dir="auto">// Load Wi-Fi, Servo and Led libraries<br />
#include &lt;WiFi.h&gt;<br />
#include &lt;ESP32Servo.h&gt;<br />
#include &lt;FastLED.h&gt;<br />
#include &lt;Preferences.h&gt;</p>
<p dir="auto">// number of leds on board and data pin<br />
#define NUM_LEDS 1<br />
#define LED_DATA_PIN 27<br />
// Define the array of leds<br />
CRGB leds[NUM_LEDS];</p>
<p dir="auto">//Create Servo Object<br />
Servo servo;</p>
<p dir="auto">// Setup network credentials<br />
const char* ssid     = "SMCS";<br />
const char* password = "**********";</p>
<p dir="auto">// Set web server port number to 80<br />
WiFiServer server(80);</p>
<p dir="auto">// Variable to store the HTTP request<br />
String header;</p>
<p dir="auto">// Auxiliar variables to store the current output state<br />
String SliderValue = "0";         // Contains returned value of Speed Slider range 0-1023<br />
int Speed = 180;                  // Contains Integer value of Speed Slider range 0-180 deg for Servo<br />
int OldSpeed = 180;               // Contains previous speed<br />
int Index;                        // String index</p>
<p dir="auto">unsigned long time_now = 0;       // Used to calculate time outs<br />
String EngineName = "Millie";     // Engine name</p>
<p dir="auto">// Assign output variables to GPIO pins</p>
<p dir="auto">// M5 Stamp pin to GPIO Mapping used by Train Controller<br />
// 5v   positive 5 volt supply<br />
// Gnd  Ground Supply<br />
// G32   GPI32  Servo Pin</p>
<p dir="auto">const int ServoPin = G32;  // Servo Drive GPI32</p>
<p dir="auto">// Current time<br />
unsigned long currentTime = millis();<br />
// Previous time<br />
unsigned long previousTime = 0;<br />
// Define timeout time in milliseconds (example: 2000ms = 2s)<br />
const long timeoutTime = 2000;</p>
<p dir="auto">// Set-up<br />
void setup() {</p>
<p dir="auto">// Initialize the output variables as outputs<br />
// Start with motor Drive control<br />
servo.attach(ServoPin);</p>
<p dir="auto">// Start the serial monitor<br />
Serial.begin(115200);</p>
<p dir="auto">// Set up Fastled and turn it To White<br />
FastLED.addLeds&lt;SK6812, LED_DATA_PIN, GRB&gt;(leds, NUM_LEDS);<br />
leds[0] = CRGB::White;<br />
FastLED.show();</p>
<p dir="auto">// Connect to Wi-Fi network with SSID and password<br />
Serial.print("Connecting to ");<br />
Serial.println(ssid);<br />
WiFi.begin(ssid, password);<br />
while (WiFi.status() != WL_CONNECTED) {<br />
delay(500);<br />
Serial.print(".");<br />
}<br />
// Print local IP address and start web server<br />
leds[0] = CRGB::Green;<br />
FastLED.show();<br />
Serial.println("");<br />
Serial.println("WiFi connected.");<br />
Serial.println("IP address: ");<br />
Serial.println(WiFi.localIP());<br />
server.begin();</p>
<p dir="auto">}</p>
<p dir="auto">// Main program<br />
void loop() {<br />
WiFiClient client = server.available();             // Listen for incoming clients<br />
if (client) {                                       // If a new client connects,<br />
leds[0] = CRGB::Blue;			      // Go Blue<br />
FastLED.show();<br />
Serial.println("New Client.");        // print a message out in the serial port<br />
String currentLine = "";              // make a String to hold incoming data from the client</p>
]]></description><link>https://community.m5stack.com/post/15545</link><guid isPermaLink="true">https://community.m5stack.com/post/15545</guid><dc:creator><![CDATA[silentmonkey]]></dc:creator><pubDate>Sat, 20 Nov 2021 19:56:46 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Thu, 18 Nov 2021 06:09:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/trrevvorr" aria-label="Profile: trrevvorr">@<bdi>trrevvorr</bdi></a> That is the problem I am finding.<br />
IDF is a nightmare to install and configure.</p>
]]></description><link>https://community.m5stack.com/post/15509</link><guid isPermaLink="true">https://community.m5stack.com/post/15509</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Thu, 18 Nov 2021 06:09:42 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Thu, 18 Nov 2021 03:35:41 GMT]]></title><description><![CDATA[<p dir="auto">These examples would be very much appreciated. I've been having trouble getting ESP-IDF or Arduino IDE to flash any code to my M5Stamp-C3 since there are virtually no examples of how to do this on the internet.</p>
]]></description><link>https://community.m5stack.com/post/15508</link><guid isPermaLink="true">https://community.m5stack.com/post/15508</guid><dc:creator><![CDATA[trrevvorr]]></dc:creator><pubDate>Thu, 18 Nov 2021 03:35:41 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Tue, 16 Nov 2021 10:25:21 GMT]]></title><description><![CDATA[<p dir="auto">They are coming once a stable setup and guide can be created.</p>
]]></description><link>https://community.m5stack.com/post/15491</link><guid isPermaLink="true">https://community.m5stack.com/post/15491</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Tue, 16 Nov 2021 10:25:21 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stamp C3 programming examples on Tue, 16 Nov 2021 10:10:57 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/auct" aria-label="Profile: AucT">@<bdi>AucT</bdi></a></p>
<p dir="auto">if you are familiar with ESP-IDF you probably could modify the <a href="https://github.com/espressif/esp-idf/tree/master/examples/get-started/blink" target="_blank" rel="noopener noreferrer nofollow ugc">ESP-IDF blink example</a> to change colors as well.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/15490</link><guid isPermaLink="true">https://community.m5stack.com/post/15490</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 16 Nov 2021 10:10:57 GMT</pubDate></item></channel></rss>