Show Posts
Pages: 1 ... 9 10 [11]
151  Using Arduino / Sensors / Re: Max photoResistor on: March 02, 2012, 08:02:23 pm
ok - lol i was mistaken ,, || or works better ,, Thank you smiley
152  Using Arduino / Sensors / Re: Max photoResistor on: March 02, 2012, 07:32:42 pm
Code:
if (((Left > threshhold) || (Right > threshhold)) && (Left > Right + difSense))

wouldn't that read - if left is greater than threshhold - or - right is greater than threshhold -- AND -- left greater than right plus differance...

 would that make the code if eather sensor was above threshhold?

is this better
Code:
if (((Left > threshhold) && (Right > threshhold)) && (Left > Right + difSense))

wouldn't work smoother with the compairitor of && (and) to make sure both are below tolarance ?
153  Using Arduino / Sensors / Re: Max photoResistor on: March 02, 2012, 07:22:23 pm
also would you think with the possable error of syntax , would it make it when the photoresistors are at there max light the the left and right section not operate . or not operate from the threshold section ?
154  Using Arduino / Sensors / Re: Max photoResistor on: March 02, 2012, 07:13:52 pm
awsome more info to work with smiley time for new symble research, I'll see how this works and post my results smiley
155  Using Arduino / Sensors / Max photoResistor on: March 01, 2012, 09:03:02 pm
im controlling a Stepper with a photoResistor set, But if the values run to high it doesnt run the code like there is no difference between the sensors,,,, See if any on can see where my codeing is creatign the failer,, any suggestions would be greatly appreciated smiley
Code:

/*
Thomas Wood
PhotoCell Controlled Stepper Motor Left and Right
Feb 15,2012
 */

#include <Stepper.h>

const int stepsPerRevolution = 200;  // Turns of the motor
int inputPhotoLeft = 0; // photresistors pin
int inputPhotoRight = 1; // photresistors pin
int Left = 0; // Store readings from the photoresistors.
int Right = 0; // Store readings from the photoresistors.

int threshhold = 450;
// this is here from reading the serial monitors valued to get a ruff Idea of value to set A
                      //And how dark you Want your motor to stop moving at

int difSence = 20; // differenace tolarance between sensors

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);
void setup() {
 
  myStepper.setSpeed(150);
 
  Serial.begin(9600);
 
   pinMode(13, OUTPUT); //led doesnt need to be on
}
void loop() {
 Left = analogRead(inputPhotoLeft); // sets the photcells position left - right
 Right = analogRead(inputPhotoRight);
 //Lines for debugging ,analog display of sensor values
Serial.print(" Left \t");
Serial.print(Left);
Serial.print("  Right \t");
Serial.println(Right);
delay(1000);

(13 == LOW);
if ((Left > threshhold) > (Right + difSence > threshhold ))
{
 
  Serial.print("clockwise \t");
  Serial.println(Left);
    myStepper.step(-stepsPerRevolution);
 
 
  }
if  ((Right > threshhold) > (Left + difSence > threshhold ))
{
 
  Serial.print("counterclockwise \t");
  Serial.println(Right);
   myStepper.step(stepsPerRevolution);
 
 
}

if ((Left < threshhold) && (Right < threshhold))
{
  // this is to limit the after dark operation -
  //no need in a plane,train,street light or automobil to make the panel move :)
  Serial.println("Lower threshhold Reached - hopefully we have stopped");
  Serial.print("Left Sensor \t");
  Serial.print(Left);
  Serial.print("   Right Sensor \t");
  Serial.println(Right);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
delay(5000);
}
 
{
 // these are here to disengage the coils as not to hold ,and in turn over heat the motor
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);

}
}

156  Using Arduino / Installation & Troubleshooting / Re: dead uno on: February 26, 2012, 02:16:20 pm
hmm and if it does not , then the USB controller is Dead ? then eather its replace the board, Possable add a USB mini, or use a ethernet controller ?
wonder if any simple way to test if its just the controller with what i have avaliable .
157  Using Arduino / Installation & Troubleshooting / dead uno on: February 26, 2012, 01:36:07 pm
Well it apears that mine has  died smiley-sad . a crappy part is i'm not even sure why. It was sitting idle, came back and it would no longer show up in a com port , not on other computers eather ( but still is lite up properly). So the question is there any way to track down wether its just the ATMEGA328 or another supporting circuit on board with just metering? If it turns out its just the ATMEGA I may just Order another and replace the chip, I just wouldn't want to have another fail from something on board, that i could have easly troubleshooted.
Any thought would be awsome smiley
158  Community / Exhibition / Gallery / Re: Solar Tracking Code on: February 16, 2012, 06:11:35 am
Yes all i have to do is run it on a Large Turn table, to call it complete smiley
159  Community / Exhibition / Gallery / Solar Tracking Code on: February 16, 2012, 05:48:14 am
Since of course I'm New to the increasingly exciting World of Arduino, I have been messing with my uno for several days learning Coding.
I have done , Probably what others have already , but couldn't find a complete setup. So i have created a ( Currently easly changed to 2) single axis Stepper Driven VIA recycled Transistor and a Printer motor. Running 2 Photoresistors,for direction of course .With many trials an errors, I have ( I think) all of the coding set where it needs to be. I know there have be other possable uses of GPS /Time tracking systems,but this one was more fun.
Have even set low light threshhold and travel limit switch. (1 currently)
Lets see what others think smiley  ....
Anyone think it would be a goood idea to include a return to original rotation position from the limit switch , or do you think it would cause more headache than good smiley ?

Code:
/*
Thomas Wood
PhotoCell Controlled Stepper Motor Left and Right
Feb 15,2012
 */

#include <Stepper.h>

const int stepsPerRevolution = 48;  // Turns of the motor
   int inputPhotoLeft = 0; // photresistors pin
 int inputPhotoRight = 1; // photresistors pin

int Left = 0; // Store readings from the photoresistors.
 int Right = 0; // Store readings from the photoresistors.

int threshhold = 550; // this is here from reading the serial monitors valued to get a ruff Idea of value to set A
                      //And how dark you Want your motor to stop moving at

 int switchOff = 12; // adds a Rotation Limit Switch
 int switchState = 0 ; // Sets the limits Switches State
 


// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);


void setup() {
  // Motor RPMs I Didn't want it to jerk on start
  myStepper.setSpeed(20);
  // initialize the serial port:
  Serial.begin(9600);
   pinMode(switchOff, INPUT);
}

void loop() {
  Left = analogRead(inputPhotoLeft); // sets the photcells position left - right
 Right = analogRead(inputPhotoRight);
 
 
switchState = digitalRead(switchOff); // gets the reading from the limit switch

if ((Left < threshhold) && (Right < threshhold))
{
  // this is to limit the after dark operation - no need in a plane,train,street light or automobil to make the panel move :)
  Serial.println("Lower threshhold Reached - hopefully we have stopped");
  Serial.print("Left Sensor \t");
  Serial.print(Left);
  Serial.print("   Right Sensor \t");
  Serial.println(Right);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
delay(500);

}



 // the +20 is to reduce possable jitter between photcell readings
  if ((Left > threshhold) > (Right +20 >threshhold))
{
  // runs the motor a 1/4 turn per instance
  
   Serial.print("clockwise \t");
   Serial.println(Left);
  
  myStepper.step(-stepsPerRevolution/4);
  delay(500);
  
}
  
   if  ((Left +20 > threshhold) <  (Right > threshhold))
{
   // runs the motor a 1/4 turn per instance
  Serial.print("counterclockwise \t");
  Serial.println(Right);
  
  myStepper.step(stepsPerRevolution/4);
  delay(500);

}
// checking the limit switch to see if its engaged then move the motor back for 1 second
if (switchState == HIGH)
{
  myStepper.step(stepsPerRevolution);
Serial.println("Limit Switch Engaged And Moving Motor In Reverse");
delay(1000);

}
// this line is only realy here to see the state of the switch
// - not realy currently to do anything
if (switchState == LOW)
{

 // Serial.println("Switch Is Off");
  delay(1000);
}

{
  // these are here to disengage the coils
//as not to hold and in turn over heat the motor
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
}
}
160  Using Arduino / Sensors / Code Post Solar Tracker on: February 15, 2012, 09:22:37 pm
Since of course I'm New to the increasingly exciting World of Arduino, I have been messing with my uno for several days learning Coding.
I have done , Probably what others have already , but couldn't find a complete setup. So i have created a ( Currently) single axis Stepper Driven VIA recycled Transistor and a Printer motor. Running 2 Photoresistors,for direction of course .With many trials an errors, I have ( I think) all of the coding set where it needs to be. I know there have be other possable uses of GPS /Time tracking systems,but this one was more fun.
Have even set low light threshhold and travel limit switch. (1 currently)
SO ok here is the long drawn out question. I would like others to have the Coding. Can /Should it be posted here.
If so is this the best thread location? smiley
O if u havent guessed, I have mostly built it as a Solar tracker smiley
Pages: 1 ... 9 10 [11]