Monday, October 20, 2014

I have been spending quite a bit of time with Pcomp.. it is tough slogging.

I am seeing a dim light at the end of the tunnel,however and seem to be making some hesitant progress.. I re did the button as I was determined to get three working in parallel..

This is quick clip


As for the midterm.. finally got something working.. It seems that your project is only as good as your components and my components s--k..

The motors were crap and could not fit anything on them except tape .. I will redo with better components.. Also the Shield did not specify which pins were used for what direction.. so could not specifically access the speed.. got photocell to control on and off and leds at same time so in a sense have bare bones of machine..

I think for a performance object I will have the reaction be to light.. as in the actor using phone or small flashlight to activate creature.. ie; would follow the performers or participants light..

here is a little rough but fun video..

looked at github.. but did not have energy to do at the moment.. will get to soon..


here is code.. is basic but will develop..
-------------------------------------------------------------
int led1 = 04;
int led2 = 05;

int photocellPin = 3;//set sensor pin
int photocellReading;  //set reading of sensor
int Ledbrightness; // set led function
#include "MotorDriver.h"

void setup()
{
  Serial.begin(9600);// begin serial out

  // initialize the digital pin as an output.
  pinMode(led1, OUTPUT);
   pinMode(led2, OUTPUT);
  /*Configure the motor A to control the wheel at the left side.*/
  /*Configure the motor B to control the wheel at the right side.*/
  motordriver.init();
  motordriver.setSpeed(150,MOTORB);
  motordriver.setSpeed(150,MOTORA);
}

void loop()
{
  photocellReading = analogRead(photocellPin); // read sensor
  Serial.print("Analog reading = ");
  Serial.println (photocellReading);
 // photocellReading = 1023 - photocellReading;
  Ledbrightness = map(photocellReading, 0, 1023, 0, 255);// map sensor
  analogWrite(led1, Ledbrightness); // make both leds go on
  analogWrite(led2, Ledbrightness);
  if (photocellReading > 50){

 digitalWrite(led1, HIGH);   // turn the LED on (HIGH is the voltage level)
  //delay(1000);               // wait for a second
 
  // turn the LED off by making the voltage LOW
  //delay(1000);{
   digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
  //delay(1000); 
  }
else if

 (photocellReading < 50) // wait for a second
 { digitalWrite(led2, LOW);
  digitalWrite(led1, LOW);
  // turn the LED off by making the voltage LOW
  delay(1000);

  }
if (photocellReading > 50) {
   Serial.println("dark");
 
  motordriver.goForward();

delay(1000);

 

}
else if (photocellReading < 50){
    motordriver.stop();
    Serial.println("dark");
 //delay(1000);
}
  }


-----------------------------------------------------------

and get caught up on rest by next week.....


No comments:

Post a Comment