Giter Site home page Giter Site logo

arduino-cheat-sheet's Introduction

Arduino Cheat Sheet

This is a page- or poster-sized cheat sheet for Arduino programmers. It draws primarily from the Arduino Language Reference, including most of the common, basic syntax and a variety of the built-in functions.

Cheat Sheet

It is based on a cheat sheet by Gavin Smith and an SVG adaptation by Frederic Dufourg. Additionally, the Arduino Uno board drawing is adapted from an Arduino board drawing in Fritzing (under a CC-BY-SA license).

Please let me know if you find any errors -- Thanks!

Download

The latest version of the PDF can be downloaded directly from GitHub here.

Translation

A Spanish translation with a redesign and added information is available in MicroCodeSV/Acordeon-arduino.

License

CC BY-SA This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

arduino-cheat-sheet's People

Contributors

liffiton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-cheat-sheet's Issues

Mention on the drawing that the pins are 40 mA in and out

Since the current in and out of the pins on the Arduino are one of the unique qualities that sets it apart from other microcontrollers, you might mention on the drawing that the pins can sink or source 40 mA.

PICs are only 25 mA. Raspberry Pis are only 16 mA.

digitalread

For consistency across documentation, it might be nice to have digitalread changed to digitalRead.

Add versioning

Per a request from a 'user': It would be helpful to have version numbers or other versioning on the cheat sheet itself to help differentiate copies that end up floating around out there.

Several other proposed changes

Mark, thanks for accepting my other change. I have a few more suggestions. I looked at a lot of documentation style guides. They are pretty much universal in using:

Arguments separated by the '|' ( ) bar notation are mutually-exclusive.
Arguments or option-arguments enclosed in the '[' and ']' notation are optional and can be omitted.
To indicate required arguments, Angled brackets ‘<...>’ are commonly used, following the same grouping conventions as square brackets. (You actually use this in your function example).

See the following for reference:
IEEE standard: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
Google: https://developers.google.com/style/code-syntax
Wikipedia: https://en.wikipedia.org/wiki/Usage_message
Doxygen: https://www.doxygen.nl/manual/commands.html

  1. Based on the above, I propose you use the following:
    attach(pin, [<min_uS>, <max_uS>])
    pinMode(pin, <INPUT | OUTPUT | INPUT_PULLUP>)
    digitalWrite(pin, <HIGH | LOW>)
    analogReference(<DEFAULT | INTERNAL | EXTERNAL>)
    shiftOut(dataPin, clockPin, <MSBFIRST | LSBFIRST>, value)
    attachInterrupt(interrupt, func, <LOW | CHANGE | RISING | FALLING>)

I also propose you use:
tone(pin, freq_Hz, [duration_ms])
and eliminate:
tone(pin, freq_Hz)
which might give you enough room to squeeze in:
byte shiftIn(dataPin, clockPin, <MSBFIRST | LSBFIRST>)
for completeness.

  1. You show the pulseIn() function. In looking at the Arduino Language Reference page, it seems like pulseInLong() has replaced it. It says, “pulseInLong() is an alternative to pulseIn() which is better at handling long pulse and interrupt affected scenarios.”

I propose you replace:
unsigned long pulseIn(pin, [HIGH, LOW])
with:
unsigned long pulseInLong(pin, <HIGH | LOW>, [timeout])

  1. If you have enough space, I would document that “value” ranges from 0...255 in:
    analogWrite(pin, value)

  2. I pound on my students to use bytes to declare pins on the Arduino since you want to save RAM space and there are less than 256 pins on any Arduino. You have an example on your sheet:
    int myPins[] = {2, 4, 8, 3, 6};
    I propose you use:
    byte myPins[] = {2, 4, 8, 3, 6};
    Just think, this one example on your sheet might get some people to start writing better Arduino code!

  3. This suggestion I can live without since you would have to chop something out and that might be difficult (I’d suggest the Servo library since it’s the only one you show that’s not physically attached to the Arduino). My suggestion is to add the following from the Arduino Language Reference page for completeness:

isAlpha()
isAlphaNumeric()
isAscii()
isControl()
isDigit()
isGraph()
isHexadecimalDigit()
isLowerCase()
isPrintable()
isPunct()
isSpace()
isUpperCase()
isWhitespace()

Thanks for listening and thanks again for such a great reference sheet!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.