0% found this document useful (0 votes)
24 views3 pages

Definisi Pin Yang Digunakan: Program Arduino Inventer 3 Phasa

The document contains an Arduino program for controlling a three-phase system using specific digital pins. It sets up the pins for output, reads an analog value from a potentiometer to adjust timing, and executes a loop that alternates the state of the pins to create a phase sequence. The timing for each phase is dynamically adjusted based on the potentiometer reading.

Uploaded by

furqon maulana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

Definisi Pin Yang Digunakan: Program Arduino Inventer 3 Phasa

The document contains an Arduino program for controlling a three-phase system using specific digital pins. It sets up the pins for output, reads an analog value from a potentiometer to adjust timing, and executes a loop that alternates the state of the pins to create a phase sequence. The timing for each phase is dynamically adjusted based on the potentiometer reading.

Uploaded by

furqon maulana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Program Arduino inventer 3 phasa

// definisi pin yang digunakan


int PIN_D10 = 5;
int PIN_D9 = 3;
int PIN_D8 = 9;
int PIN_D7 = 6;
int PIN_D6 = 11;
int PIN_D5 = 10;
//pengaturan waktu
int between = 60;
int on_time = 1200;
int val = 0;

void setup()
{
Serial.begin(9600);
pinMode(PIN_D10, OUTPUT); // Set pin untuk logika high
pinMode(PIN_D9, OUTPUT);
pinMode(PIN_D8, OUTPUT);
pinMode(PIN_D7, OUTPUT);
pinMode(PIN_D6, OUTPUT);
pinMode(PIN_D5, OUTPUT);

digitalWrite(PIN_D10, LOW); // set pin untuk logika low


digitalWrite(PIN_D9, LOW);
digitalWrite(PIN_D8, LOW);
digitalWrite(PIN_D7, LOW);
digitalWrite(PIN_D6, LOW);
digitalWrite(PIN_D5, LOW);
delay(100);
}
void loop()
{
on_time = 1500;
val = analogRead(A0); // pembacaan nilai potensio
val = (1024-val);
on_time = on_time+(val*4);
Serial.println(on_time); // print data waktu

digitalWrite(PIN_D7, HIGH);
delayMicroseconds(on_time);
digitalWrite(PIN_D5, LOW);
delayMicroseconds(between);
digitalWrite(PIN_D6, HIGH);
delayMicroseconds(on_time);
digitalWrite(PIN_D10, LOW);
delayMicroseconds(between);
digitalWrite(PIN_D9, HIGH);
delayMicroseconds(on_time);
digitalWrite(PIN_D7, LOW);
delayMicroseconds(between);
digitalWrite(PIN_D8, HIGH);
delayMicroseconds(on_time);
digitalWrite(PIN_D6, LOW);
delayMicroseconds(between);
digitalWrite(PIN_D5, HIGH);
delayMicroseconds(on_time);
digitalWrite(PIN_D9, LOW);
delayMicroseconds(between);
digitalWrite(PIN_D10, HIGH);
delayMicroseconds(on_time);
digitalWrite(PIN_D8, LOW);
delayMicroseconds(between);
}

You might also like