Arduino information - quasics/quasics-frc-sw-2015 GitHub Wiki
Arduino programming
- Arduino project site
- Some tutorials
- One possible pathway for our team
- From the Arduino project
- Some commercial kits we've picked up
- Scott's newfangled Extra Credit Program
- Additional documentation
- Shield pin usage (or, "What pins can I safely use when other stuff is stacked on top of an Arduino?")
What the heck is an Arduino?
To quote from the site for the Arduino project:
Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board.
Putting it more simply? It's an inexpensive little computer on a circuit board the size of your hand, that you can easily write code on to interact with the Real World. But it doesn't run Windows, Linux, or any other operating system: anything that it does is something that you've written code to teach it to do. And there's an awful lot of folks who have written tutorials to help you learn to do this, and to design/wire circuits to control things.
The design for the hardware is "open source", meaning that it's OK for other people to use in designing, building, and selling boards of their own.
The basic Arduino boards are often pretty minimal in terms of what they can do, but there are a lot of accessory boards (called "Shields", because they usually cover the top of an Arduino board) that you can buy and plug directly into an Arduino to make it do other stuff: communicate with other computers via Ethernet/WiFi, control DC motors, etc.
How to get the hardware
Want to get some hardware to play with? This is the stuff that Matt has been buying for the team's use, but there's lots of other sellers out there.
- Arduino Uno
- This is a small, single-board unit with a basic set of I/O pins. It's great for basic experimentation.
- Arduino Mega
- This is the Uno's bigger sibling, providing a number of additional I/O ports and other pins, as well as more memory (so you can store bigger programs or run longer light strips :-).
- Arduino Nano
- This is one of the Uno's little siblings. It's a single chip (well, OK, technically "a surface mount breadboard embedded version with integrated USB"), generally plugged into a breadboard for use in whipping up a more dedicated circuit.
- Please note that:
- You may need to set change the "Processor" setting (on the "Tools" menu in the Arduino IDE) to "ATmega328P (Old Bootloader)" in order to program these devices.
- A custom serial port driver may need to be installed in order for the Arduino IDE to communicate with them, depending on which version of the Nano you buy: the original version used a chip from FTDI for USB, which is supported by most operating systems, but is more expensive than the CH340 chips used in a lot of clones (and which is not necessarily built into every OS). These drivers can be found by doing a search for "CH340 drivers ".
- A couple of kits from SunFounder, providing LEDs, motors, wires, etc., and available with/without an Arduino:
- A couple of kits from Elegoo:
There's also "Arduino MKR" boards that are newer, smaller, and often have more functionality than the Uno/Mega/Nano devices that we've used on the team. (Feel free to shop around!)
Sample code
- Code developed by/for Quasics
- Network communications (e.g., for controlling an Arduino from a RoboRio)
- Initial examples:
- Arduino UDP sample program - demonstrates how an Arduino can listen for commands that are broadcast to it from other devices on the network (and use that to turn an LED on/off)
- Linux UDP sample program - demonstrates how to broadcast commands via UDP from Linux devices (e.g., a RoboRio)
- Java UDP sample program - simple program for interactively testing code running on an Arduino
- More complete examples:
- Simple lighting subsystem and command - look at the "LightingSubsystem" and "AutoLighting" classes.
- Arduino networked NeoPixel sample program - more sophisticated example, listening for broadcast commands to control a NeoPixel strip.
- Initial examples: