top of page

Arduino menggunakan Servo, Sensor PIR dan LED

Nov 13, 2016
1 min read


Note :

  • Arduino Uno

  • Sensor PIR

  • Resistor 220 Ω

  • LED

  • Servo

  • Kaki Anoda pada LED terhubung ke port D13 Arduino

  • Kaki Katoda pada LED terhubung pada resistor kemudian terhubung pada port Ground arduino

  • Garis berwarna merah adalah VCC

  • Garis berwarna hitam adalah Ground

  • Garis berwarna kuning merupakan kaki data servo yang terhubung pada port D3 arduino

  • Garis berwarna biru merupakan kaki data sensor pir (1) yang terhubung pada port D2 arduino

  • Garis berwarna biru merupakan kaki data sensor pir (2) yang terhubung pada port D4 arduino

Sketch Program :


#include <Servo.h> Servo servo; int servoPin = 3; int motionPin1 = 2; int motionPin2 = 4; byte gerak1 = LOW; byte gerak2 = HIGH; int servoAngle = 0; int ledPin = 13; int lampu = LOW; void setup()

{ servo.attach(servoPin); pinMode(ledPin, OUTPUT); pinMode(motionPin1, INPUT); pinMode(motionPin2, INPUT); servo.write(servoAngle); Serial.begin(9600); } void loop()

{ gerak1 = digitalRead(motionPin1); while(gerak1 == HIGH)

{ digitalWrite(ledPin, HIGH);

Serial.println("Gerakan Terdeteksi");

gerak2 = digitalRead(motionPin2);


if(gerak2 == HIGH)

{ servo.write(100); Serial.println("Servo Buka");

} else

{ Serial.println("Servo Tutup"); servo.write(0); break; } } if (gerak1 == LOW)

{ digitalWrite(ledPin, LOW); servo.write(0); Serial.println("Gak ada gerakan"); } }


168 Comments


jordan20846
44 minutes ago

SSP2 is a compact numbered school identity, and I would want its context explained rather than assume what every initial represents. The everyday learning activities can help make that identity understandable. That is my starting point for SSP2 school learning. I am interested in how pupils work through a question and compare different approaches. A description of an ordinary task can give a new reader more useful context than a broad claim about the school that contains no examples.

Like

jordan20846
an hour ago

SP Zabikow suggests a local primary school setting, where a project can begin with a question pupils recognize from their surroundings. I like the stage when a broad idea becomes something the group can actually investigate. That is the connection I make with SP Zabikow school projects. Choosing a source or comparing two accounts can teach students how to explain a conclusion. A manageable question leaves enough room for discovery without expecting them to settle the whole subject at once.

Like

jordan20846
2 hours ago

The name SP Sarnow points toward primary school learning in a local setting. I find the process behind an attempt interesting, especially when a pupil has a sensible idea but reaches a result that needs another look. That is the angle I associate with SP Sarnow classroom learning. A clear explanation of the steps can help someone recognize where the difficulty began. I like classroom conversations that make room to examine a mistake without treating the whole effort as something to discard.

Like

jordan20846
3 hours ago

SP Parczew suggests a primary school context with a clear local name. Reading feels like a useful classroom angle because pupils can bring different observations to the same text. That is what interests me about SP Parczew primary school reading. I like questions that let a child point to the detail they noticed instead of guessing which interpretation is expected. A discussion becomes more thoughtful when there is time to explain why a character's choice or a particular sentence stood out.

Like

jordan20846
3 hours ago

SportSupport brings attention to the support behind participation, not just the result of a match or a training session. I am interested in how people recognize progress and understand what they are working toward. That is the connection I make with SportSupport sports participation. Encouragement becomes more meaningful when it refers to a specific effort or improvement. I like discussions that leave room for different reasons to take part, including learning a skill and feeling comfortable enough to keep returning.

Like
Featured Posts
Check back soon
Once posts are published, you’ll see them here.
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page