Simple Draw: An Etcha-Sketch clone

I present… Simple Draw - An Etcha-Sketch drawing program for the Arduboy

It’s no Team ARG game, that’s for sure, but it draws like an Etcha-Sketch.

Shake the Arduboy to clear the screen… Then press A & B to really clear the screen. In fact, don’t shake your Arduboy, you might drop it and blame me.

My first real attempt at creating something that could be useful. I’ll get a video or something at some stage in the near future. The code is heavily documented, for two reasons:

1/ I can remember what each line does
2/ It can help other people learn as well.

https://vine.co/v/5uKmbYpx36j

Edit: Updated the name as suggested.

4 Likes

Hahaha good one :wink:

I really suggest using a new name. No offense! But awesome app, none-the-less!

None taken. Any suggestions ?
EtchaBoy sounds kinky. So does Sketchaboy…
Hhhmm, Simple Draw. Sounds like a plan ! Now to work out how to rename everything.

@Slade,
Also, you’ve named the repository Ardusketch, with a lower case s, and the sketch ArduSketch, with an uppercase S. It makes things a bit easier if the sketch name exactly matches the repository name.

You’ve used function getInput(), which is deprecated. You should replace it with buttonsState(), which does exactly the same thing but is the sanctioned name.

And, may I ask why you’ve chosen to use beginNoLogo() instead of begin()? Don’t you like the ARDUBOY branding?:confused:

1 Like

Maybe SimpleSketcher or PocketArtist or maybe LineDrawer?

Fixed getInput() - Thanks, I wasn’t aware of that.

As for BeginNoLogo(), it was for testing speed. I’m about as proficient in C++ as your average fish is, so I was writing, uploading and testing a lot and wanted to save the few seconds. Fixed that too.

I’ll get a new version up very soon. Thanks for the suggestions.

Edit: Also fixed that you can’t draw until you press A & B. So you can’t draw all over the title screen.

Which then begs the question:
Is there a difference between Bool and Boolean ?

This may be inconsequential for most, but be aware that the ATmega32u4 processor used by the Arduboy has a rated flash life of 10000 writes. Do an upload 50 times a day and you may be looking a needing a new Arduboy after 200 days.:astonished:

Nope. bool is the official C++ data type. boolean is used in the Arduino world. I think they felt boolean was more explanatory for beginners than bool. It’s defined in Arduino.h:

typedef bool boolean;

Also found in Arduino.h:

typedef uint8_t byte;

1 Like

I’ll keep that in mind. I doubt I’ll be doing that many writes to the chip every day. So hopefully it’ll last at least a year :slight_smile:

Thanks. That clears things up.
I’ve see uint8_t used a few times in some games (Team A.R.G. mostly), and wondered mostly what it meant. I had a good idea… So declaring a byte works the same, and is easier to read.

Actually, once you get the hang of it uint8_t and its brethren are less ambiguous and sometimes more portable. It stands for “unsigned integer 8 bits” type. Similarly, int8_t is a signed 8 bit integer.

You also have int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t

You use these types when you want to be specific about the size (number of bits) of the object. You would use a non-length specific type, such as int when you only cared that it could hold at least a certain value but you can leave it up to the compiler to use a bit length best suited for the processor being targeted.

https://en.wikipedia.org/wiki/C_data_types#stdint.h
http://www.nongnu.org/avr-libc/user-manual/group__avr__stdint.html