Arduino 5 : Blink dan Faded Implementasi Analog dan Digital

1. Membuat On-Off LED menggunakan Arduino 

Tujuan : 
Mengimplementasikan sinyal digital di Arduino Microcontroller

Alat dan Bahan :
Hardware :
  • ProtoBoard / BreadBoard (Minimal 1)
  • Jumper (Minimal 1)
  • LED (Minimal 1)
  • Arduino(di Contoh menggunakan Arduino Pro micro) [Minimal 1]
  • Resistor (Minimal 1, diantara 1k-10k ohm)
  • USB Type A male to Type micro (Minimal 1)


Software :
  • Arduino IDE
Langkah-Langkah :
1. Pasang Resistor LED Arduino seperi pada gambar berikut :
2. Setelah itu upload code berikut ke Arduino IDE.


/* =======================
 *  sufyan97.blogspot.co.id
 *  on-off LED
 ===========================*/
const int LEDH = 6;
const int LEDM = 7;

void setup() {
  // put your setup code here, to run once:
  pinMode(LEDH,OUTPUT);
  pinMode(LEDM,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(LEDH,HIGH);
  digitalWrite(LEDM,LOW);
  delay(500);
  digitalWrite(LEDH,LOW);
  digitalWrite(LEDM,HIGH);
  delay(500);
}

3. Realisasi :


2. Membuat LED Faded menggunakan Arduino.

Tujuan : 
Mengimplementasikan sinyal analog di Arduino Microcontroller

Alat dan Bahan :
Hardware :
  • ProtoBoard / BreadBoard (Minimal 1)
  • Jumper (Minimal 1)
  • LED (Minimal 1)
  • Arduino(di Contoh menggunakan Arduino Uno R3) [Minimal 1]
  • Resistor (Minimal 1, diantara 1k-10k ohm)
  • USB Type A male to Type B male (Minimal 1)
Langkah-Langkah :
1. Pasangan resistor dan LED seperti rangkaian berikut.
2. copy dan compile code berikut :

/* =======================
 *  sufyan97.blogspot.co.id
 *  Faded LED
 ===========================*/
const int LED = A0;


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(LED,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  for (int i = 0; i < 255; i+=5)
  {
    analogWrite(LED, i);
    Serial.println(i);
    delay(200);
  }
}
3. Realisasi

Posting Komentar untuk "Arduino 5 : Blink dan Faded Implementasi Analog dan Digital"