Intro to using Arduino
I've just been given a Biomaker grant, which came with a lot of Arduino hardware as a kit. I've not used Arduino before so I'm exploring the documentation online and noting which bits are good, where there are areas that are tougher to find out about. I wanted to note what I'm finding here in case it helps others. So here's what I've found:
Arduino Microcontroller guide is a good introduction to the electronics of the Arduino. It also covers the basics of computer programming, and the syntax of the Arduino language.
Arduino shields is a good basic introduction to using shields.
Keep it simple
Initially I thought it would be great to use lots of the hardware that I've been given, but the complexities quickly spiralled out of control, as it's often hard to find good code and the docs that I need to make different bits of kit work together. In the end I've found that it's best to aim for the most minimalist setup that I can think of that still gets the job done. That way I can get everything to work together and not have inexplicable bugs.
There is a dedicated Arduino Discussion Forum, where we can take technical questions. Arduino The Arduino itself was very clearly explained in the introductory docs mentioned above.
This kit is easy to use. There are small maps in the box, and if I copy the wiring diagrams on them and use the downloaded code then they just work, really easily.
This kit is more difficult to use. The docs on the Seeed site are lagging somewhat behind the really great hardware. To get better help, I tried searching for the name of the individual component (e.g. light sensor) on mouser.com to find useful docs like this or just searching for the name of the component with “Arduino”.
I haven't used this yet.
I am not using this as I don't get on with LED displays.
Gtronics Proto Shield PlusI haven't used this either, although it is extremely cool looking.
Stacking shieldsIf stacking more than one shield on top of an arduino, I have learned that it’s important to check that the shields are not using the same pins on the arduino to send and receive messages. Otherwise the messages will get muddled up. Below are pages that list which pins are used by which shields:
Which pins does the Grove Base shield use?As far as I can see, this depends on which plugs on the shield we are using. For example if we are using the plug that says I2C then we are only using pins GND, VCC, SDA and SCL which are the labels written on the board next to the wires on that plug. GND, SDA and SCL are all places that pins can go in the black bars at the side of the Arduino. VCC is a label on the switch that changes the voltage.
Further information is given on the Grove page that goes with this specific version of the kit. For example this page says that on the I2C ports: “Below the digital ports are four I2C Grove ports. I2C is a low-speed bus protocol that transfers data via two wires: SCL and SDA. SCL is the clock line for synchronizing data transfer over the I2C bus; SDA is the data line.”
Installing the IDE (programming environment)The Arduino IDE is a free download. It is simple and works well. It doesn't give much help on bug fixing, which is tricky with longer programs. I tried more complex software tools but none were easy to set up, so I have decided to just keep my code really simple and bug fix by eye.
Code syntax checking IDEI tried out Visual Studio and PlatformIO IDE, but couldn’t get it to work. I also tried tried Atom with PlatformIO-IDE but it does not support debugging with Arduino Uno. Visual Studio did not even list Arduino Uno as an option. I also tried Eclipse but it turned out that the set up of the Arduino plugin was not well enough documented and ended up being impossible to get right.
Including librariesSome things in the kit, like the LCD screen, need libraries to be installed. The Arduino site gives help on how to install new libraries that are not yet in the programming environment (IDE).
Once the library is installed, if you want to include it in your sketch (computer program) then you can just do this: