// // 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. // // I added xyz #include // // globals // #define numpixels 1 #define pixelpower 11 #define pixelpin 12 #define bufsize 25 char buf[bufsize]; int count=0; // // 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() { int ch; // // check for a char // if (Serial.available()) { // // read, save, and send char // ch = Serial.read(); if (ch = 1) { pixel.setPixelColor(0,pixel.Color(255,255,255)); pixel.show(); delay(200); } else if (ch = 0) { pixel.setPixelColor(0,pixel.Color(0,0,255)); pixel.show(); delay(200); } else if (ch = 2) { pixel.setPixelColor(0,pixel.Color(255,0,0)); pixel.show(); delay(200); } else { pixel.setPixelColor(0,pixel.Color(0,255, 255)); pixel.show(); delay(200); } } else { pixel.setPixelColor(0,pixel.Color(0,255, 0)); pixel.show(); delay(200); } }