Devices & Components
Arduino Uno Rev3
Perma-Proto Breadboard Half Size
SG90 Micro-servo motor
Jumper wires (generic)
LDR module
Software & Tools
Arduino IDE
Project description
Code
Code
arduino
1#include<Servo.h> 2 3Servo Dithira;//dithira is the tag i selected and it can be changed!!! 4void setup() { 5 Dithira.attach(9);//the servo motor 6pinMode(12,INPUT);//the ldr sensor 7} 8 9void loop() { 10 if (digitalRead(12)==HIGH){//reading the LDR sensor(looking for shadows) 11Dithira.write(60); 12delay(100); 13} 14else{ 15 Dithira.write(0); 16 delay(100); 17} 18 19 20 21} 22
Code
arduino
1#include<Servo.h> 2 3Servo Dithira;//dithira is the tag i selected 4 and it can be changed!!! 5void setup() { 6 Dithira.attach(9);//the servo motor 7pinMode(12,INPUT);//the 8 ldr sensor 9} 10 11void loop() { 12 if (digitalRead(12)==HIGH){//reading the 13 LDR sensor(looking for shadows) 14Dithira.write(60); 15delay(100); 16} 17else{ 18 19 Dithira.write(0); 20 delay(100); 21} 22 23 24 25} 26
Downloadable files
Circuit diagram
Circuit diagram

Comments
Only logged in users can leave comments