-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example sketch #14
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 51: char _canvasBuffer[canvasWidth][canvasHeight] = {0};
Should be changed to- char _canvasBuffer[canvasWidth][canvasHeight] = {{0}};
This would fix compilation issue of array must be initialized with a brace-enclosed initializer.
Thanks for your input @MisterAwesome23! I think it's a good idea to do this, but I am curious to learn more because the current code works fine for me, without even a compiler warning. I see lots of recommendations to use |
I was using an Adafruit Feather Huzzah ESP8266 while testing. It's true, {{0}} is rare initialiser but has a larger code compilation coverage I guess. Also, thank you so much collecting and forming this. I am working on an example for ArduinoGraphics under GSoC proposal demonstration and this has been a great resource for reference. |
Thanks for the information. I am able to reproduce the error and have now pushed your recommended fix.
You're welcome. My primary motivation for writing this example was to allow compilation testing of this library. However, I have since seen that it has other uses. It's nice to be able to copy/paste some text from Serial Monitor to show exactly the the output I'm seeing without needing to take a picture of some display hardware. I'm fortunate enough to own a MKR RGB Shield, so I can try the library out on some display hardware, but not all the contributors have a MKR RGB Shield. The size of the RGB matrix is also limiting to be used for testing and development of the library.
I would recommend that you also look at the Arduino_MKRRGB library, since that demonstrates a more complete application of this library: |
Oh that is so great! I hope to get one as well if ArduinoGraphics gets a part in GSoC2020 and I get selected :)
Is it why you have chosen 61X27 canvas. If so, I'll make sure I use the same dimensions while formulating examples. Thanks for recommending this, I am looking in to that to get more ideas. |
Be sure to take note of this bug:
No, the MKR RGB Shield is only a 12x7 matrix! 61x27 is just the space required to fit the "ARDUINO" text as well as some decorative borders that demonstrate the use of the |
The example sketch uses the ArduinoGraphics library to draw ASCII art and print it to the Serial Monitor.
The example sketch uses the ArduinoGraphics library to draw ASCII art and print it to the Serial Monitor.
This is an alternative to #10
I wanted an example sketch that didn't require any additional display hardware. This is what I came up with.
It's not very beginner friendly code, but I don't think it's possible to avoid that without involving another library.
It's a bit hacky in that the
r
parameter is used to set the character to draw with and theg
andb
parameters are unused.