Monday, June 28, 2021

Signs of a simpleton having fun with a new microcontroller:

  1. Write a program that makes the LED blink like a mother fucker.
  2. Write a program that spams a hello world to USB serial.
  3. Write a Read Eval Print Loop over USB serial.
Compared to what I've done in C with simpler micros like the 8051 family, I'm finding the RP2040 really damned nice. Not only because of the Cortex M0's horse power, but because of the really nice library that comes with the Raspberry Pi Pico. For the hell of it, I decided to abuse it with some simple C++ by for the REPL just to see that C++ I/O and string handling, does in fact work.

Of course, me being me, I ended up with a really simple set of commands:

static string evalline(const string& line)
 {
     if (line.empty())
         return "";

     if (line == "monkey")
         return "Willow?";
     if (line == "monster")
         return "Corky?";
     if (line == "sweet")
         return "Misty?";
     if (line == "help")
         return "Try nicknames with fur";

     blink(100);
     blink(100);
     blink(100);
     return string("Unknown command: ") + line;
 }

Because why not? 😜

No comments:

Post a Comment