// // hello.RP204-XIAO.blink-echo.ino // // Seeed XIAO RP2040 blink and echo hello-world // // Neil Gershenfeld 2/12/23 // // This work may be reproduced, modified, distributed, // performed, and displayed for any purpose, but must // acknowledge this project. Copyright is retained and // must be preserved. The work is provided as is; no // warranty is provided, and users accept all liability. // #include // // globals // #define numpixels 1 #define pixelpower 11 #define pixelpin 12 // // setup // Adafruit_NeoPixel pixel(numpixels,pixelpin,NEO_GRB+NEO_KHZ800); void setup() { Serial.begin(); pixel.begin(); pinMode(pixelpower,OUTPUT); digitalWrite(pixelpower,HIGH); } // // main loop // void loop() { char chr; int code; // // check for a char // if (Serial.available()) { // // read, save, and send char // chr = Serial.read(); int code = (chr + 0) - 48; if( code > 0 and code <= 9) { for(int i = 0; i < code; i++) { pixel.setPixelColor(0,pixel.Color(255,0,0)); pixel.show(); delay(300); pixel.setPixelColor(0,pixel.Color(255,255,255)); pixel.show(); Serial.print("."); delay(200); } } Serial.println(); } }