Micro Arcade Reverse Engineering

Awesome I have it reading and parsing the JSON from the community, with a little bit of coding magic I will get it to display the most recent post :slight_smile:

This is a pain in the ass as the JSON responses from discourse are massive and cannot be easily manipulated. Doing some hacky stream parsing implementation because I actually only care about figuring out what the first post number is.

Ugh, I always struggle with getting variables in scope… I’m such a noob sometimes.

Any help from the resident coding wizards?

in ExampleParser.cpp I have:

void ExampleListener::value(String value) {
  Serial.println("value: " + value);
    postId = value;

and I want to use postId in the main sketch, but it is out of scope.

What is the best (any) way to pass that value so I can use it within the .ino

ping @Pharap

listener.showId() will (from the looks of things) return a copy of the postId.

Three potential problems with that:

  • If you alter the copy the original will stay the same, i.e. listener.showId().someModifyingOperation() would modify the copy, not the original, which might not be desirable
  • Copying a string is an O(n) operation and should therefore be avoided if you can
    • I.e. make showId return String & (a reference instead of a copy) if at all possible. And if you do that it would be a good idea to make it const-correct.
  • showId isn’t a very accurate name since you’re only retrieving (a copy of) the post id, you’re not actually displaying the post id. Something like getPostId() would be better

Just for the record (since other people might find this info useful as well) you don’t actually need the 0 here:

uint8_t buff[128] = { 0 };

If you do uint8_t buff[128] = {}; it has the same effect of zero-initialising the array.
As does uint8_t buff[128] {}; (as of C++11).

For comparison, using uint8_t buff[128] = { 1 }; would give you an array where the first element was 1 and all the remaining elements were 0.
I.e. = { x }; doesn’t mean "fill the array with x", it means "zero-initialise the array, then set the first element to x"

1 Like

I just need the value so that I can spit it into another string. It contains the most recent post number so I just need it to generate the url: community.arduboy.com/posts/{showId}.json

So a copy wshould work just fine.

How would this change look like in the code? I’m not super familiar with how to do that. The reference should be ok too, I just need access to the number to create another string.

UPDATE: listener.showId() worked out for me.

I went ahead and changed the function to getPostId() for you! :slight_smile: Thank you!

1 Like

Haha this is so cool it works!

Hello World!

Testing 12342069


(If you use #HelloWorld in your post and I see it I’ll take a picture and post it !)


#HelloWorld Hi Kevin!

You helped me find a bug! It’s refreshing the page properly but not updating which post is the newest correctly. I had to reset the controller to get yours up. Some more fiddling and it will automatically update, like it should!

1 Like

#HelloWorld Hey Kevin!

Now battery powered!

It’s got some problem that is causing it to crash every so often, if I had to guess I’m overflowing a buffer somewhere…?

I’ll have to make it report the heap and see if I’ve got a leak somewhere.

Next up, break out the buttons!

1 Like

#HelloWorld Gratz Kevin, it’s fun to works on projects, isn’t it ?

#HelloWorld Lurk Off, this looks interesting, have you correctly implemented character wrapping and scrolling so that all this text can be read properly without clipping?

// ExampleParser.h
String & getPostId();
// ExampleParser.cpp
String & ExampleListener::getPostId() {
  return postId;

And to make it const-correct introduce a second version:

// ExampleParser.h
const String & getPostId() const;
// ExampleParser.cpp
const String & ExampleListener::getPostId() const {
  return postId;

Appending & to a type makes it a reference,
much like how appending * makes a type a pointer.

References are a safer alternative to pointers because they can’t (legally) be null,
and they can only be bound to an object once.
(More info: 1, 2, 3.)

When exactly is it crashing?
Are you sure that’s not just the 1 minute delay at the end of loop?

StackOverflow isn’t as good as it used to be anyway,
it lost a lot of its best users after the Monica incident.


Micro Arcade


Does that means that you may consider a color screen at some point for some version of the Arduboy? (since they exist for Micro Arcade) If so, I’d be very interested!

@luxregina, did you read through this topic?

1 Like

I skimmed through it, but aside @bateske saying “And I am NOT designing a new product”, I cannot really find anything else related to my question - am I missing something?

And the reason why I’m asking, just to be perfectly clear, is really to show that there is some interest (at least from my end) being involved in developing color games for Arduboy :slight_smile: …maybe that can help tip a scale, somewhere?

I may have posted it before, can’t remember, haven’t been here for a while, but there’s this https://youtu.be/NoiNglv6kRU that I started working on, for fun… it would be great on a handheld console such as a color Arduboy :slight_smile:

Sorry @Jean-Charles_Lebeau and @Bergasms I was sleeping when those got posted, now it’s something from @MLXXXp from a different thread and he didn’t use the hashtag!

@Pharap Thanks for showing that! I’ll have to do more research on pointers and reference and the differences between them. I learned this all a long time ago, 20 years in APCS class and then proceeded to code in javascript almost exclusively after that.

Undetermined, it seems to be random. It could be 30 minutes in or something, maybe 15, maybe 5 I haven’t observed it close enough. It’s not just the delay, it runs the setup routine again.

I’ve done some casual google searching and it seems like there are all sorts of spurious conditions in software that can accidentally trigger the ESP32 watchdog which is what seems like is happening. Could also potentially be a power spike due to WIFI and not a big enough cap on the board. It seems like it’s better when plugged into the battery so that might be it.

UPDATE: Nope it crashed again, I’m bringing in very large strings and then parsing through the json, so I don’t know how well the cleanup is on those libraries.

There are no plans for a color Arduboy or mass-producing anything in the future. (For now, plans can change)

I’d like to build this replacement PCB for the Micro Card, think of it kind of like a stop-gap to nowhere.

I’ve still got to decide on which GPIO to assign to the buttons and speakers, and I think I’m going to copy what ODROID GO did just to try and maintain some compatibility possibly. Need to look more at that.

But at the end of the day, when you think about it, all Arduboy is the architecture. It’s defining a specific set of GPIO for a specific processor and graphics controller. Whether you buy a completed Arduboy or you make a DIY home-made, the games are still the same.

So perhaps, by creating this semi-official MicroArcade mod (still need to come up with a name) it sort of becomes a default standard for Arduboy Color?

That actually brings me to a whole other can of worms, is once I “release” this, meaning publish the schematics, code samples, and probably offer a handful of PCBS, is that I think I might also spin up a separate forum for it. Since it doesn’t make sense to have it combined here. So when you think about it in that way, it does start to look like a “next product”.

But the thing is, the main reason Arduboy is so successful is probably because it means that your game can play on really nice high quality hardware. I think if there was only the home-made versions, it’s possible people would not be so motivated to put so much energy into making awesome games.

The fact that so many people bough it just based on its “cool factor” means that there is as big of an audience for diy home made open source games as there is likely possible.

Which is to say, if I only sold as much as several dozen of the Micro Arcade ESP32 Mod boards, would that even be a significant crowd of developers? I can’t imagine selling much more than that. But for me, it still seems fun. It’s the reason I built the original Arduboy, because I wanted one. I don’t know maybe after I put it together, and figure out how to smash the doom port that runs on this chip to output to this display and I make a video. Doom on a credit card could be pretty cool.

This post really sort of is echoing things I’ve said in the thread:

Because, as I already mentioned in this post, what I’m building now is basically just a smaller ODROID GO, which has more features and still isn’t even that popular.


That was my reasoning and why I thought I should ask for clarification :slight_smile:
Unfortunately, I’m not an electronic guru, so the idea that Arduboy was a “turnkey” solution was attractive to me. Building a mod wouldn’t be an option for me.

And just to define the motivations behind making “dark and under” for example: as an artist that grew up during the video game explosion in the 80s, I absolutely love to work around tight constraints. The size of the screen, the black and white were fun to design “around”… but a slightly bigger screen, and color, would also represent a fun challenge. Right now, I’m working on more production-heavy VR games, so going back to a low-tech project, but with color this time, would be super attractive :slight_smile:

Those three links I left you would be a good start.
They’re all to chapters at learncpp which is still my most highly recommended C++ tutorial.

Otherwise I’m always happy to answer any C++-related questions, regardless of skill level or complexity of question.

No clue what that is.

If String is Arduino’s String then it ought to be doing proper cleanup,
I don’t know about the others - I don’t know where their source or documentation is.

(Casting len to size_t when len is -1 is a bit suspect though.)

How large is “very large”?

It’s certainly possible that the heap is being exhausted, particularly if the memory fragmentation is serious enough.

That’s not the only possibility though, things other than memory exhaustion can cause a ‘crash’ (which I assume means “the device resets itself” rather than “the device freezes”).