MASIGNALPHAS2101
6680671983845063762

Cara Membuat Program Motor DC kesegala Arah dengan Arduino

Cara Membuat Program Motor DC kesegala Arah dengan Arduino
Add Comments
8/08/2016
- Jalankan Software Arduino
- Kemudian tuliskan program dibawah ini pada halaman kosong software arduino seperti dibawah ini:
Listing Program:

void setup()
{
  pinMode(kirimaju_pin, OUTPUT);       // sets the pin as output
  pinMode(kirimundur_pin, OUTPUT);     // sets the pin as output
  pinMode(kananmaju_pin, OUTPUT);      // sets the pin as output
  pinMode(kananmundur_pin, OUTPUT);    // sets the pin as output
}

void loop()
{
val = analogRead(analogPin);   // read the input pin
analogWrite(ledPin, val / 4);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
delay (500);
  analogWrite(kananmaju_pin, 10);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kananmundur_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kirimaju_pin, 10);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kirimundur_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
delay (500);
  analogWrite(kananmaju_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kananmundur_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kirimaju_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kirimundur_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
delay (500);
  analogWrite(kananmaju_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kananmundur_pin, 10);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kirimaju_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kirimundur_pin, 10);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
delay (500);
  analogWrite(kananmaju_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kananmundur_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kirimaju_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
  analogWrite(kirimundur_pin, 255);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
delay (500);
}

Hestech Indonesia

Innovasi di bidang Teknologi, Listrik, Teknik Komputer dan gaya Hidup. Info lainnya tentang praktik konservasi berbasis Sains, inovasi, dan kearifan lokal