Skip to main content

SAM 15x15 quick start guide

Published: 29 October 2016
Last updated: 28 September 2018

SAMD21 development board 15x15mm (Arduino compatible)SAMD21 development board 15x15mm (Arduino compatible)

SAM 15x15

See here the whole article and how to buy. See here for the installation procedure.

SAM 15x15 with 2.54mm headersSAM 15x15 with 2.54mm headers

Simple example programs

SerialUSB

Printing to the serial monitor. 
To see the printed data from the beginning, you'll need to add while(!SerialUSB) inside the setup(). This will ensure the SAMD21 will wait for the Serial port to open before executing the sketch:

#include <Streaming.h>
void setup() 
{ SerialUSB.begin(9600); // works also without
  while(!SerialUSB); // print from the start 0, 1, 2 ... instead of 22, 23, 24 ...
}
int i;
void loop()
{ SerialUSB << i++ << endl; 
  delay(100);
}

digitalWrite 

Blink the onboard LED:

void setup() 
{ pinMode(d[9], OUTPUT);
}
void loop()
{ static bool b;
  digitalWrite(d[9], b=!b); // blink onboard led (pin 12)
  delay(300);
}

analogRead 

Measure the input voltage on pin11 and print the value to the serial monitor:

void setup() 
{ SerialUSB.begin(9600); // for native USB port
}
void loop()
{ SerialUSB.print(analogRead(d[8])); // pin 11
  SerialUSB.print("\n");
  delay(300);
}

analogWrite 

Put a PWM voltage on pin 5: 

void setup() 
{ 
}
void loop()
{ analogWrite(d[2], 77); // PWM output 3.3V * 77/255 = 1V on pin 5
}

Other articles from SAMD21