Skip to content

Instantly share code, notes, and snippets.

Buttons and the Serial monitor

What about if you want to find out what the Arduino is doing? You can communicate with it using the Serial Monitor.

In this example, use an Digital pin as an input to detect when a button is pressed.

Imgur

When the button is pressed the input value changes from 0 (LOW) to 1 (HIGH) and you can write this value to the Arduino's serial port.

Two LEDs on a breadboard

An electronics breadboard (as opposed to the type on which sandwiches are made) is actually referring to a solderless breadboard. These are great units for making temporary circuits and prototyping, and they require absolutely no soldering.

The circuit below uses 2 resistors to limit the current flowing through the LEDs.

Imgur

This sketch uses two digital pins on the Ardunio, set as outputs, to control the LEDs.

Getting started with Arduino

Introducing Arduino Uno

An Arduino is a really useful microcontroller. The one shown below is an Uno, but you can use most other models with the same code and circuit (althought you may need to search up the pinout to work out which pins to use).

The Arduino is connected to your computer via USB. You create programs - called sketches - using the Arduino IDE and download them to the device using this cable.

To successfully connect you need to select the correct Board and Port from the Tools menu.

@topshed
topshed / MB_CD_python.md
Last active August 21, 2018 08:08
Draft activity for CoderDojo starter pack (Micro:Bit Python)

Making a Crowd Display with Micro:Bits and Python

Program a set of Micro:Bits so that they talk to each other via radio to create a synchonised light show.

Design your image

  1. Connect the Micro:Bit to your computer using the USB cable.
  2. Open the Mu editor.
  3. Add the following code to import the Micro:Bit libraries you'll need.
@topshed
topshed / gist:32031368da774252782f39dd39f10b1c
Last active February 6, 2018 14:36
Draft activity for CoderDojo starter pack (Micro:Bit Blocks)

Making a Crowd Display with Micro:Bits and MakeCode

Program a set of Micro:Bits so that they talk to each other via radio to create a synchonised light show.

Design your image

  1. Connect the Micro:Bit to your computer using the USB cable.
  2. Open the MakeCode webpage (makecode.microbit.org) or run the offline versions (pxt serve).
  3. Drag these blocks from the Basic group.