This tutorial walks through blinking an LED with the Arduino Giga R1 WiFi, using a digital output pin to switch it on and off. It is the simplest possible way to see GPIO control in action, and the same technique scales to turning any device on or off through a driver circuit.
The full tutorial, with every detail and the line-by-line code explanation, is on our site: Arduino Giga R1 WiFi LED Blink
What you need
- Arduino Giga R1 WiFi
- USB Cable Type-A to Type-C (for USB-A PC)
- USB Cable Type-C to Type-C (for USB-C PC)
- LED Kit
- LED (red)
- LED Module
- Button and LED Kit
- 220Ω Resistor
- Breadboard
- Jumper Wires
- Screw Terminal Block Shield for Arduino Uno/Mega/Giga
- Sensors/Servo Expansion Shield for Arduino Mega/Giga
- Breadboard Shield for Arduino Mega/Giga
- Enclosure for Arduino Giga
- Power Splitter for Arduino Giga
- DIYables Sensor Kit (18 sensors/displays)
Wiring
Connect the LED's cathode (-), the shorter lead with the flat edge on the case, to GND. Connect the anode (+), the longer lead, through a 220Ω resistor to a GPIO pin such as pin 9. The resistor limits current so the LED does not draw more than the Arduino's pins or the LED itself can handle. Getting the polarity backwards will not let current flow, so the LED just stays off rather than damaging anything at these voltages, but a module with a built-in resistor simplifies the wiring if you want to skip the standalone resistor.
How it works
An LED only lets current through in one direction, from anode to cathode, once the voltage across it is high enough to forward-bias its internal junction. Setting the GPIO pin HIGH applies 3.3V, which exceeds that threshold and lets current flow through the resistor and LED, lighting it. Setting the pin LOW drops the voltage to 0V, so there is no potential difference and the LED turns off. The resistor value is chosen so the current stays around a few milliamps, well within what the pin can safely source.
Code
The sketch sets the pin as an output with pinMode(pin, OUTPUT), then uses digitalWrite() to drive it HIGH or LOW with delays in between, which is what makes the LED blink. The same approach works for the board's built-in LED and for an external one; you just point the code at a different pin.
arduino-giga-r1-wifi-led-blink.ino
/*
* This Arduino Giga R1 WiFi code was developed by newbiely.com
*
* This Arduino Giga R1 WiFi code is made available for public use without any restriction
*
* For comprehensive instructions and wiring diagrams, please visit:
* https://newbiely.com/tutorials/arduino-giga/arduino-giga-r1-wifi-led-blink
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Full tutorial
The complete tutorial - wiring diagram, code explanation and troubleshooting - is here: https://newbiely.com/tutorials/arduino-giga/arduino-giga-r1-wifi-led-blink

Top comments (0)