Congrats on building your first circuit with the Adafruit Metro!

Let's play around to make your circuit better and learn some more tricks/tips that will be useful later on.

Change the pin

The LED is connected to pin 13 but we can use any of the METRO’s pins. To change it take the wire plugged into pin 13 and move it to a pin of your choice (from 0- 13)

You can also use analog 0-5, Analog #0 is 14, Analog #1 is 15, etc.

Then in the code change all occurrences of LED_BUILTIN -> newpin. That is, change every  LED_BUILTIN to 8

Then Upload the sketch:  by pressing ctrl+u

Change the Blink time

Unhappy with one second on one second off? In the code change the lines:

digitalWrite(LED_BUILTIN, HIGH);
delay(time on); //(seconds * 1000)
digitalWrite(LED_BUILTIN, LOW);
delay(time off); //(seconds * 1000)

Control the brightness

Along with digital (on/off) control the METRO can control some pins in an analog (brightness) fashion. (more details on this in later circuits). To play around with it. Change the LED to pin 9: (also change the wire) by replacing all LED_BUILTIN with 9

Replace the code inside the { }'s of loop() with the following line:

analogWrite(9, new number);

Note that in the line above,

new number is any number between 0 and 255. 0 turns the LED completely off. 255 is the maximum brightness of the LED. Anything between 0 and 255 is a varying brightness. Play around and find one that you like. 

Fading

We will use another included example program. To open go to File > Examples > 3.Analog > Fading 

Then upload to your board and watch as the LED fades in and then out.

This guide was first published on Aug 18, 2017. It was last updated on Jun 12, 2017.

This page (Make It Better ) was last updated on Jun 13, 2017.

Text editor powered by tinymce.