DFRduino Robot Workshop

Hello everyone! I hope we do have an enjoyable workshop. If you find anything this difficult to understand, find me at the end of the session and please do say, it’ll help me make it clearer for the next run of the workshop.

Requirements

If you’re unsure of whether you have a sufficient level of programming skill, see whether you can understand the code below. I’ve commented it to try and help you understand it. If you have trouble, try reading my introduction and following the Arduino links at the bottom of the page.

// Declare the variables we'll use in the sketch
// Definitions of variables come in the form:
// [type] [name] = [value];
// int stands for integer (a whole number, not a decimal)
int delayTimeInMiliSeconds = 500;
// LEDs are a type of light
// A pin is a port on the arduino in which we can plug wires into and control
// things
int ledPin = 13;

// setup() runs only once
void setup() {
    // Set the ledPin (13) to be an output
    pinMode(ledPin, OUTPUT);
}

// Loop runs continuously, when it's finished, it reruns itself
void loop() {
    // Here we run the 'flash()' function over and over again
    flash();
}

// This is the 'flash()' function definition
// Function definitions look like this:
// [type] [name]() {
//      [code]
// }
// 'type' is the type of value returned if you use any 'return' statments in
// your function. E.g. 'void' if you don't return anything.
// 'name' is the name you use to run the code, e.g. 'flash'
// 'code' is the code that your function will run when you call it. 'call'ing a
// function is achieved by writing 'name()'
//
// The curly braces: '{' and '}' enclose the code that runs when
// 'flash()' is run.
void flash() {
    // digitalWrite allows us to control a pin (in this case, pin 13) and change
    // it's value.
    digitalWrite(ledPin, HIGH);
    // delay for the amount of time we declared at the start of the sketch
    delay(delayTimeInMiliSeconds);
    // output a LOW (0V) signal on the ledPin
    // this turns the LED off, as it will no longer have a current flowing
    // through it
    digitalWrite(ledPin, LOW);
    // Again, delay like last time
    delay(delayTimeInMiliSeconds);
}

Outline of the workshop:

  1. PRIMER: Introduction to Arduino and C (IMPORTANT for beginners with little experience), if you’re already familiar with programming, just take a brief look and then move on to the workshop material.
  2. Introduction to the DFDuino robot platform
  3. Making your robot move
  4. Sensing distance
  5. Avoiding obstacles

Also see Debugging (fixing problems)

If you were smitten with the robot and want to build one yourself then you can find a list of components here

Throughout the workshop you may find you have gaps in your knowledge. You should be able to find out everything you need to know at these links: