02: Introduction to Electronics
by Adwoa Asare
Arduino and LEDs
In today’s lab I:
- made a circuit with an arduino uno
- sautered an arduino nano
- made a circuit with an arduino nano
- programmed an arduino nano
Materials needed:
- arduino nano
- arduino uno
- (3) 100 ohm resistors
- bread board
- plugin wires for bread board -wire stripper
- 3 LEDs
- sautering gun
- sauter
- usb to mini cable
- usb cable
- power source
Arduino uno circuit
- (2) Wires were stripped, one red and one black
- The black wire was connected to the ground (GND) plugin on the arduino uno
- The red wire was connected to the 5v output on the arduino uno
- The wires and components were plugged into the breadbord as shown:
This idea can be expanded by adding another LED in parallel:
Arduino Nano Circuit
- The arduino nano parts were placed on the breadboard for stablization then sautered on
- The arduino nano was then secured onto the center section of the breadboard
-
The circuit was put together as shown:
- The following code was used th make the lights blink in a successive pattern:
int led_blue=5;
int led_white=4;
int led_green=3;
void setup() { // put your setup code here, to run once:
pinMode(LED_BUILTIN, OUTPUT);
pinMode(led_blue,OUTPUT);
pinMode(led_white,OUTPUT);
pinMode(led_green,OUTPUT);
}//void setup()
void loop() { // put your main code here, to run repeatedly:
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on by aking the voltage HIGH
digitalWrite(led_green,HIGH);
delay(200);
digitalWrite(led_white,HIGH);
delay(200);
digitalWrite(led_blue,HIGH);
delay(200);
digitalWrite(led_green,LOW);
delay(200);
digitalWrite(led_white,LOW);
delay(200);
digitalWrite(led_blue,LOW);
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
}//void loop()