BlinkM + PIR

Alright so i tried this before, see if i can post a little better picture of where i'm having problems, i'm new i'm in AZ got my arduino, BlinkM, PIR sensor.

This is what i'm trying to do.
I'd like my PIR when triggered set the BlinkM to white 0xff,0xff,0xff...

I'm running the example scripts trying to find something that works for me, but it's not clicking. i'm trying to start simple.

for one i also dont know how to write something as simple as getting the blinkm to show a single color from scratch. (Yea this is how new i really am) I've read the data sheet

What i'm asking for is can someone maybe point me in right direction with some base code, i just want a PIR sensor to send a specific color to blinkm.... with the basic PIR sketch i've made the PIR send power to BlinkM but then it runs the default sketch preloaded with Blinkm.

Just looking for a sample code, so i can build on.... any help would be appreciated. this learning curve is really not snapping for me... something as simple as turning on the LED sure i can do... sending a specific I2C bus (and i think i'm using the term correctly) is becoming very difficult.

I got it working, just took me a while…

Actually did a BlinkM with 2x PIR’s each sending different singles to BlinkM

The project is going to be each room in my house will affect the BlinkM differently… so while i’m in bed if the light turns red, i know it’s detected movement in the red room… Which will be the living room, Blue for my hallway… so i know where people are in my house at all times…

Code here.

#include “Wire.h”
#include “BlinkM_funcs.h”

#define blinkm_addr 0x00
int delay_time = 500; // time betwen colors, 1000 milliseconds = 1 second
int calibrationTime = 30;
byte r,g,b;

//the time when the sensor outputs a low impulse
long unsigned int lowIn;

//the amount of milliseconds the sensor has to be low
//before we assume all motion has stopped
long unsigned int pause = 5000;

boolean lockLow = true;
boolean takeLowTime;

int pirPin = 3; //the digital pin connected to the PIR sensor’s output PIR 1
int pirPin2 = 2;

/////////////////////////////
//SETUP
void setup(){
Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(pirPin2, INPUT);
digitalWrite(pirPin, LOW);
digitalWrite(pirPin2, LOW);

//give the sensor some time to calibrate
Serial.print(“calibrating sensor “);
for(int i = 0; i < calibrationTime; i++){
Serial.print(”.”);
delay(1000);
}
Serial.println(" done");
Serial.println(“SENSOR’S ACTIVE”);
delay(50);
BlinkM_beginWithPower();
BlinkM_stopScript( blinkm_addr ); // turn off startup script
}

////////////////////////////
//LOOP
void loop(){

if(digitalRead(pirPin2) == HIGH){
BlinkM_setRGB (blinkm_addr, 0x00,0x00,0xff );
delay(delay_time);
BlinkM_setRGB (blinkm_addr, 0xff,0xff,0xff );
delay(delay_time);
BlinkM_setRGB (blinkm_addr, 0x00,0x00,0xff );
if(lockLow){
//makes sure we wait for a transition to LOW before any further output is made:
lockLow = false;
Serial.println("—");
Serial.print(“motion detected on sensor 2 at “);
Serial.print(millis()/1000);
Serial.println(” sec”);
delay(50);
}
takeLowTime = true;
}

if(digitalRead(pirPin2) == LOW){

if(takeLowTime){
lowIn = millis(); //save the time of the transition from high to LOW
takeLowTime = false; //make sure this is only done at the start of a LOW phase
}
//if the sensor is low for more than the given pause,
//we assume that no more motion is going to happen
if(!lockLow && millis() - lowIn > pause){
//makes sure this block of code is only executed again after
//a new motion sequence has been detected
lockLow = true;
Serial.print(“motion ended on sensor 2 at “); //output
BlinkM_setRGB (blinkm_addr, 0x00,0x00,0x00 );
Serial.print((millis() - pause)/1000);
Serial.println(” sec”);
delay(50);

}}

if(digitalRead(pirPin) == HIGH){
BlinkM_setRGB (blinkm_addr, 0xff,0x00,0x00 );
if(lockLow){
//makes sure we wait for a transition to LOW before any further output is made:
lockLow = false;
Serial.println("—");
Serial.print(“motion detected on sensor 1 at “);
Serial.print(millis()/1000);
Serial.println(” sec”);
delay(50);
}
takeLowTime = true;
}

if(digitalRead(pirPin) == LOW){

if(takeLowTime){
lowIn = millis(); //save the time of the transition from high to LOW
takeLowTime = false; //make sure this is only done at the start of a LOW phase
}
//if the sensor is low for more than the given pause,
//we assume that no more motion is going to happen
if(!lockLow && millis() - lowIn > pause){
//makes sure this block of code is only executed again after
//a new motion sequence has been detected
lockLow = true;
Serial.print(“motion ended on sensor 1 at “); //output
BlinkM_setRGB (blinkm_addr, 0x00,0x00,0x00 );
Serial.print((millis() - pause)/1000);
Serial.println(” sec”);
delay(50);
}
}
}