Motion Sensored(pir), kinetic(servor) lighting(ring led) device. Newbie fo help!

Hi all!

I'm trying to build a lamp which would move(lighting shade part)

by servor when motion is detected. and also the lighting which would be

LED ring will run, deem in and out when motion is detected.

So it is basically, PIR sensor detects -> runs Servor and LED that deems in and out.

so far below is what I have, and it would be really nice if I could get some reference or

help on integrating LED ring parts(code) into this codes.

Great Thanks always. I'm really enjoying this arduino life:)

#include <Servo.h>

Servo myservo; //creates a servo object

//a maximum of eight servo objects can be created

int pos = 0; //variable to store servo position

//amount of time we give the sensor to calibrate(10-60 secs according to the datasheet)

int calibrationTime = 30;

int pirPin = 12; //digital pin connected to the PIR's output

int pirPos = 13; //connects to the PIR's 5V pin

void setup(){

myservo.attach(9); //attaches servo to pin 4

Serial.begin(9600); //begins serial communication

pinMode(pirPin, INPUT);

pinMode(pirPos, OUTPUT);

digitalWrite(pirPos, HIGH);

//give the sensor time to calibrate

Serial.println("calibrating sensor ");

for(int i = 0; i < calibrationTime; i++){

Serial.print(calibrationTime - i);

Serial.print("-");

delay(1000);

}

Serial.println();

Serial.println("done");

while (digitalRead(pirPin) == HIGH) {

delay(500);

Serial.print(".");

}

Serial.print("SENSOR ACTIVE");

}

void loop(){

if(digitalRead(pirPin) == HIGH){ //if the PIR output is HIGH, turn servo

for(pos = 0; pos < 170; pos += 1) //goes from 0 to 180 degrees

{ //in steps of one degree

myservo.write(pos); //tells servo to go to position in variable "pos"

delay(50); //waits for the servo to reach the position


}

}

if(digitalRead(pirPin) == LOW){
  for(pos = 170; pos >= 90; pos -= 1){
myservo.write(pos);
delay(50);
}
}
}
myservo.attach(9); //attaches servo to pin 4

Which is it?

What's the problem?

BTW, the word is "dim" ( I hope)

You probably can integrate a ring of leds, do you already have one (in mind) ?

The reason I ask is that led-rings have been on the market for a number of years now. It wouldn't surprise me single color rings, RGB-rings and rings with individually addressable leds exist. Each type of ring can probably be controlled by your arduino, but needs to be controlled in its own way.

Simpson_Jr:
You probably can integrate a ring of leds, do you already have one (in mind) ?

+1

A link to the LEDs you plan to use would be helpful.

So did you ever get your continuous rotation servo to stop? Why didn't you follow up with the people trying to help?

Your code would be much easier to read if it were formatted correctly. You can use "autoformat" under "tools" to do this.

I am trying to make something similar using a motion sensor (ultrasonic range finder) but one that will turn on a light. Ideally I would like the light to go on at a slow pulse at say 10 metres, a bit faster pulsing at 6 metres, faster at 2 metres and really fast at 1 metre.

I have been able to get the ultrasonic range finder to work and read off distances to the computer. I have read up on Boolean OR program commands 'll' but having trouble putting the 'want' into 'operation'. I was wondering if this forum could help.

My car sensors can do it why can't I? Haha