Biasanya digunakan untuk simulasi kontrol lift berbasis arduino.
Cara kerja rangkaian :
Ada tiga buah push button yang berfungsi sebagai : tombol UP (putar kanan) tombol DOWN (putar kiri), dan tombol Stop.
anda juga dapat memsang indikator LED di pin digital 11, 12 dan 13 untuk memberikan tanda putar kanan, putar kiri dan stop.
jika anda ingin membuat simulasi LIFT 4 lantai, silahkan mampir postingan saya disini
sketch arduino dapat di copy dibawah ini :
.
/*
modified : by www.rokhmad.com
*/
int kasus = 0;
#define UP 2
#define STOP 3
#define DOWN 4
#define satu A0
#define dua A1
#define tiga A2
void setup() {
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);
pinMode(UP, INPUT_PULLUP);
pinMode(STOP, INPUT_PULLUP);
pinMode(DOWN, INPUT_PULLUP);
pinMode(satu, INPUT_PULLUP);
pinMode(dua, INPUT_PULLUP);
pinMode(tiga, INPUT_PULLUP);
// set the speed at 60 rpm:
// initialize the serial port:
Serial.begin(9600); }
void loop() {
if (digitalRead(UP) == LOW) {
kasus = 1;
}
if (kasus == 0 ) {
Serial.println("stop");
}
if (digitalRead(DOWN) == LOW)
{
kasus = 2; }
if (digitalRead(STOP) == LOW)
{ kasus = 0; digitalWrite(6, LOW);
digitalWrite(7, LOW); digitalWrite(13, LOW);
digitalWrite(12, LOW); digitalWrite(11, HIGH);
}
if (kasus == 1 ) {
Serial.println("putar kiri");
digitalWrite(7, HIGH);
digitalWrite(6, LOW);
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
}
if (kasus == 2 ) { Serial.println("putar kanan");
digitalWrite(6, HIGH); digitalWrite(7, LOW);
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
digitalWrite(11, LOW); } }
modified : by www.rokhmad.com
*/
int kasus = 0;
#define UP 2
#define STOP 3
#define DOWN 4
#define satu A0
#define dua A1
#define tiga A2
void setup() {
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);
pinMode(UP, INPUT_PULLUP);
pinMode(STOP, INPUT_PULLUP);
pinMode(DOWN, INPUT_PULLUP);
pinMode(satu, INPUT_PULLUP);
pinMode(dua, INPUT_PULLUP);
pinMode(tiga, INPUT_PULLUP);
// set the speed at 60 rpm:
// initialize the serial port:
Serial.begin(9600); }
void loop() {
if (digitalRead(UP) == LOW) {
kasus = 1;
}
if (kasus == 0 ) {
Serial.println("stop");
}
if (digitalRead(DOWN) == LOW)
{
kasus = 2; }
if (digitalRead(STOP) == LOW)
{ kasus = 0; digitalWrite(6, LOW);
digitalWrite(7, LOW); digitalWrite(13, LOW);
digitalWrite(12, LOW); digitalWrite(11, HIGH);
}
if (kasus == 1 ) {
Serial.println("putar kiri");
digitalWrite(7, HIGH);
digitalWrite(6, LOW);
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
}
if (kasus == 2 ) { Serial.println("putar kanan");
digitalWrite(6, HIGH); digitalWrite(7, LOW);
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
digitalWrite(11, LOW); } }
2 comments:
I think this is an informative post and it is very useful and knowledgeable. I really enjoyed reading this post.
Great reading youur blog post
Post a Comment