김선미gledeleunhee
Published © GPL3+

Digital OUTPUT and Analog OUTPUT(PWM)

This time we learn Digital OUTPUT and INPUT.

BeginnerShowcase (no instructions)1 hour3,036
Digital OUTPUT and Analog OUTPUT(PWM)

Things used in this project

Story

Read more

Schematics

digital_analog_output_input(led)_Ifc066b9JG.jpg

Code

Untitled file

Arduino
int i = 9;

void setup() {
pinMode(i, OUTPUT);
}

void loop() {
analogWrite(i, 0);
delay(1000);
analogWrite(i, 10);
delay(1000);
analogWrite(i, 20);
delay(1000);
analogWrite(i, 30);
delay(1000);
analogWrite(i, 40);
delay(1000);
analogWrite(i, 50);
delay(1000);
analogWrite(i, 60);
delay(1000);
analogWrite(i, 70);
delay(1000);
analogWrite(i, 80);
delay(1000);
analogWrite(i, 90);
delay(1000);
analogWrite(i, 100);
delay(1000);
analogWrite(i, 110);
delay(1000);
analogWrite(i, 120);
delay(1000);
analogWrite(i, 130);
delay(1000);
analogWrite(i, 140);
delay(1000);
analogWrite(i, 150);
delay(1000);
analogWrite(i, 255);
delay(2000);
}

1

Arduino
1
int led_pin = 11;
void setup(){
pinMode(led_pin, OUTPUT);
}
void loop(){
digitalWrite(led_pin, HIGH);
delay(1000);
digitalWrite(led_pin, LOW);
delay(1000);
}
[Analog OUTP]
int led_pin = 11;
void setup(){
pinMode(led_pin, OUTPUT);
}
void loop(){
analogWrite(led_pin, 0);
delay(1000);
analogWrite(led_pin, 80);
delay(1000);
analogWrite(led_pin, 160);
delay(1000);
analogWrite(led_pin, 255);
delay(1000);
}

Credits

김선미

김선미

8 projects • 2 followers
gledel

gledel

100 projects • 115 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"
eunhee

eunhee

3 projects • 1 follower

Comments