Show Posts
Pages: 1 ... 24 25 [26] 27 28 ... 39
376  Using Arduino / Installation & Troubleshooting / Re: Programming using silabs chip usb-ttl converter on: June 09, 2012, 06:33:05 pm
after numerous attempts, I connected the grounds up and it works smiley
377  Using Arduino / Project Guidance / Re: LCD reset, or how do I get a non flashing display? on: June 08, 2012, 08:56:13 am
I always try to avoid using clear(), like you say the flickering becomes annoying unless you are doing it slowly. I just print info onto, with enough empty spaces to cover up any chars that might not be used on the new data to print
378  Using Arduino / Installation & Troubleshooting / Re: Programming using silabs chip usb-ttl converter on: June 06, 2012, 06:19:58 am
Ok I'll try that later when I'm home, thanks bud
379  Using Arduino / Installation & Troubleshooting / Re: Programming using silabs chip usb-ttl converter on: June 05, 2012, 07:28:46 pm
switching the connections, rx tx etc does not seem to solve it smiley-sad

I have just looked into the DTR function, I think you are correct about the rst being an internal reset. Looking at the chips datasheet DTR is pin 28, but it does not look like they have broken it out on this board. I have soldered a wire and cap to the pin and it now resets the board fine and at the right point, but I'm still getting no data transmission? I'm wondering if it's faulty?

Thanks all
380  Using Arduino / Installation & Troubleshooting / Re: Programming using silabs chip usb-ttl converter on: June 04, 2012, 06:44:03 pm
Hi, no luck with a cap in series with reset smiley-sad is there anything else I could try?

I'm noticing the data LED in the dongle is not lighting up at all?
381  Using Arduino / Installation & Troubleshooting / Re: Programming using silabs chip usb-ttl converter on: June 02, 2012, 06:44:47 pm
Ok thanks Nick, I'll see if I can find one to try
382  Using Arduino / Installation & Troubleshooting / Re: Programming using silabs chip usb-ttl converter on: June 01, 2012, 08:14:28 pm
Hi Nick, I mean RST on the arduino and the RST pin on the programmer - as per this pin out
383  Using Arduino / Installation & Troubleshooting / Programming using silabs chip usb-ttl converter on: June 01, 2012, 06:33:24 pm
hi all, I have just got one of the following http://www.ebay.co.uk/itm/300587914146?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649 installed the drivers all seems ok, but can't load code onto a 328p. I can load the code using my uno fine. This converter does not seem to put my chip in reset so the upload fails?

I've connected tx to tx, rx to rx, rst to rst and gnd to gnd but no luck?
384  Using Arduino / Programming Questions / Re: Help with a problem using while and if statements together on: May 28, 2012, 07:30:19 pm
Thanks guys, got it going now. Great tutorial, it really helped. I'm just reading the pin only in the while loop now as you suggest smiley

next step is to get rid of the delays and use a counter so I can do other tasks such as update the display, should be fun trying to get that working!
385  Using Arduino / Programming Questions / Re: Help with a problem using while and if statements together on: May 27, 2012, 08:07:16 pm
Thanks Mark, I still can't get it work - currently the final while while loop gets ignored and the program goes back to the start. Not sure what I'm doing wrong?

Code:
#include <LiquidCrystal.h>


//Pin naming
int focusPin = 2;
//int focusLED = 13;
int shutterPin = 4;
int shutterLED = 13;
int enterButton = A2;
int pauseButton = A1;
int LDRPin = A5;      // Analog input pin that the lDR is attached to
int LCDBackLight = 3;      // Analog (PWM) output pin that the BACKLIGHT is attached to
int amountPot = A4;
int intervalPot = A3;


//Parameters
int focusDelay = 800;
int shutterDelay = 800;
//int interval = 20000;
int maxInterval = 600000; //Max interval between shots in millis allowed
int maxAmount = 1000; //Maxium amount of shots allowed

const int minLight = 40;        // at or below this light level, use minimum backlight intensity
const int maxLight = 900;        // at or above this light level, use maximum backlight intensity
const int minBacklight = 20;      // lowest backlight intensity to use
const int maxBacklight = 255;    // highest backlight intensity to use

int LDRRead = 0;         // value read from the LDR
int outputValue = 0;     // value output to the PWM (analog out)

int intervalRead = 0;         // value read from the interval pot
int amountRead = 0;         // value read from amount of photos pot

int interval = 0;
int amount = 0;





// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {

  //Set up LCD
  lcd.begin(16, 2);
  delay(100);

  //Set up pins
  pinMode(focusPin, OUTPUT);
  pinMode(shutterPin, OUTPUT);
  pinMode(shutterLED, OUTPUT);
  pinMode(LCDBackLight, OUTPUT);
  pinMode(enterButton, INPUT);
  pinMode(pauseButton, INPUT);


  //enable pull ups on buttons
  digitalWrite(enterButton, HIGH);
  digitalWrite(pauseButton, HIGH);


}


void loop(){


  int shots = 0;

  // LDR controlled LCD backlight via PWM part
  int sum = 0;
  for (int i=0; i<16; i++) // take 16 samples from the analog input
  {
    sum += analogRead(LDRPin);
  }
  LDRRead = sum/16; // divide by the amount of samples for the average value

  // map it to the range[0..255] of the analog output that the LCD backlight it connected to
  outputValue = LDRRead/4;   // alternative to map function for scaling down from analog input
  outputValue = map(constrain(LDRRead, minLight, maxLight), minLight, maxLight, minBacklight, maxBacklight );

  // change the analog out value to adjust LCD backlight intensity
  analogWrite(LCDBackLight, outputValue);   



  // read interval from pot
  intervalRead = analogRead(intervalPot);
  interval = map (interval, 0, 1023, 0, maxInterval);

  // read amount from pot
  // amountRead = analogRead(amountPot);
  //amount = map (amount, 0, 1023, 0, maxAmount);

  amount = 10;


  lcd.setCursor(0,0);
  lcd.print("Shots:");
  lcd.print(amount  );

  lcd.setCursor(0,1);
  lcd.print("Delay:");
  lcd.print(interval  );


  int bval;

  bval = digitalRead(enterButton);


  //if the enter button is pressed, execute the following loop
  if (bval == LOW)
  {
    //run though the shutter loop until the number of shots has been reached
    while (shots < amount)
    {

      // LDR controlled LCD backlight via PWM part
      int sum = 0;
      for (int i=0; i<16; i++)
      {
        sum += analogRead(LDRPin);
      }
      LDRRead = sum/16;
      outputValue = LDRRead/4; 
      outputValue = map(constrain(LDRRead, minLight, maxLight), minLight, maxLight, minBacklight, maxBacklight );
      analogWrite(LCDBackLight, outputValue);


      lcd.setCursor(0,0);
      lcd.print("Shots:");
      lcd.print(amount);
      lcd.print("/");
      lcd.print(shots + 1  );

      //Trigger focus
      digitalWrite(focusPin, HIGH);
      delay(focusDelay);

      //Trigger shutter
      digitalWrite(shutterPin, HIGH);
      digitalWrite(shutterLED, HIGH);
      delay(shutterDelay);
      digitalWrite(shutterPin, LOW);
      digitalWrite(shutterLED, LOW);
      digitalWrite(focusPin, LOW);

      delay(interval + focusDelay + shutterDelay);

      lcd.clear();
      shots++;
    }
    //display message on the lcd and wait for enter button press
    digitalRead(enterButton);
    while (enterButton == HIGH)
    {
      lcd.setCursor(0,0);
      lcd.print(shots);
      lcd.print(" Shots taken");
      digitalRead(enterButton);
    }

  }


  //if enter button has not been pressed, do nothing and keep waiting
  if (bval == HIGH)
  {
    //do nothing
  }


}

386  Using Arduino / Programming Questions / Re: Help with a problem using while and if statements together on: May 27, 2012, 06:54:21 pm
Hi, thanks. That's true pretty illogical of me not to think of just putting it after  smiley-razz

I must be doing something else wrong, because now it sits in the final while loop and the message stays on screen when the enter button is pressed?

Code:
#include <LiquidCrystal.h>


//Pin naming
int focusPin = 2;
//int focusLED = 13;
int shutterPin = 4;
int shutterLED = 13;
int enterButton = A2;
int pauseButton = A1;
int LDRPin = A5;      // Analog input pin that the lDR is attached to
int LCDBackLight = 3;      // Analog (PWM) output pin that the BACKLIGHT is attached to
int amountPot = A4;
int intervalPot = A3;


//Parameters
int focusDelay = 800;
int shutterDelay = 800;
//int interval = 20000;
int maxInterval = 600000; //Max interval between shots in millis allowed
int maxAmount = 1000; //Maxium amount of shots allowed

const int minLight = 40;        // at or below this light level, use minimum backlight intensity
const int maxLight = 900;        // at or above this light level, use maximum backlight intensity
const int minBacklight = 20;      // lowest backlight intensity to use
const int maxBacklight = 255;    // highest backlight intensity to use

int LDRRead = 0;         // value read from the LDR
int outputValue = 0;     // value output to the PWM (analog out)

int intervalRead = 0;         // value read from the interval pot
int amountRead = 0;         // value read from amount of photos pot

int interval = 0;
int amount = 0;





// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {

  //Set up LCD
  lcd.begin(16, 2);
  delay(100);

  //Set up pins
  pinMode(focusPin, OUTPUT);
  pinMode(shutterPin, OUTPUT);
  pinMode(shutterLED, OUTPUT);
  pinMode(LCDBackLight, OUTPUT);
  pinMode(enterButton, INPUT);
  pinMode(pauseButton, INPUT);


  //enable pull ups on buttons
  digitalWrite(enterButton, HIGH);
  digitalWrite(pauseButton, HIGH);


}


void loop(){


  int shots = 0;

  // LDR controlled LCD backlight via PWM part
  int sum = 0;
  for (int i=0; i<16; i++) // take 16 samples from the analog input
  {
    sum += analogRead(LDRPin);
  }
  LDRRead = sum/16; // divide by the amount of samples for the average value

  // map it to the range[0..255] of the analog output that the LCD backlight it connected to
  outputValue = LDRRead/4;   // alternative to map function for scaling down from analog input
  outputValue = map(constrain(LDRRead, minLight, maxLight), minLight, maxLight, minBacklight, maxBacklight );

  // change the analog out value to adjust LCD backlight intensity
  analogWrite(LCDBackLight, outputValue);   



  // read interval from pot
  intervalRead = analogRead(intervalPot);
  interval = map (interval, 0, 1023, 0, maxInterval);

  // read amount from pot
  // amountRead = analogRead(amountPot);
  //amount = map (amount, 0, 1023, 0, maxAmount);

  amount = 10;


  lcd.setCursor(0,0);
  lcd.print("Shots:");
  lcd.print(amount  );

  lcd.setCursor(0,1);
  lcd.print("Delay:");
  lcd.print(interval  );


  int bval;

  bval = digitalRead(enterButton);


  //if the enter button is pressed, execute the following loop
  if (bval == LOW)
  {
    //run though the shutter loop until the number of shots has been reached
    while (shots < amount)
    {

      // LDR controlled LCD backlight via PWM part
      int sum = 0;
      for (int i=0; i<16; i++)
      {
        sum += analogRead(LDRPin);
      }
      LDRRead = sum/16;
      outputValue = LDRRead/4; 
      outputValue = map(constrain(LDRRead, minLight, maxLight), minLight, maxLight, minBacklight, maxBacklight );
      analogWrite(LCDBackLight, outputValue);


      lcd.setCursor(0,0);
      lcd.print("Shots:");
      lcd.print(amount);
      lcd.print("/");
      lcd.print(shots + 1  );

      //Trigger focus
      digitalWrite(focusPin, HIGH);
      delay(focusDelay);

      //Trigger shutter
      digitalWrite(shutterPin, HIGH);
      digitalWrite(shutterLED, HIGH);
      delay(shutterDelay);
      digitalWrite(shutterPin, LOW);
      digitalWrite(shutterLED, LOW);
      digitalWrite(focusPin, LOW);

      delay(interval + focusDelay + shutterDelay);

      lcd.clear();
      shots++;
    }
    //display message on the lcd and wait for enter button press
    bval = digitalRead(enterButton);
    while (bval == HIGH)
    {
      lcd.setCursor(0,0);
      lcd.print(shots);
      lcd.print(" Shots taken");

    }

  }


  //if enter button has not been pressed, do nothing and keep waiting
  if (bval == HIGH)
  {
    //do nothing
  }


}












387  Using Arduino / Programming Questions / Re: Help with a problem using while and if statements together on: May 27, 2012, 06:30:00 pm
sorry Mike I meant the while loop.

Id like to display a message on the lcd after the final shot has taken and leave it there until the enter button is pressed, then it will exit the while loop.

so basically just as the while loop is exiting id like to perform a task, but only once?

Thanks
388  Using Arduino / Programming Questions / Re: Help with a problem using while and if statements together on: May 27, 2012, 05:54:01 pm
Thanks guys, I hoped it was only something simple.

Is it possible to run something only once when the for loop becomes untrue - ie, clear the display or update it with some text after the duration has run?

Thanks again
389  Using Arduino / Programming Questions / Help with a problem using while and if statements together on: May 26, 2012, 10:11:48 pm
Hi all, I am just writing some code for a simple time lapse controller that I've built.

I am trying to integrate a button, and once it is pressed (to gnd) I want to go into a while loop with a counter built in.

The code compiles and is running, but its running through the if and for loops constantly, irrespective of the button state?

What am I doing wrong guys?

Thanks

Code:
#include <LiquidCrystal.h>


//Pin naming
int focusPin = 2;
//int focusLED = 13;
int shutterPin = 4;
int shutterLED = 13;
int enterButton = A2;
int pauseButton = A1;
int LDRPin = A5;      // Analog input pin that the lDR is attached to
int LCDBackLight = 3;      // Analog (PWM) output pin that the BACKLIGHT is attached to
int amountPot = A4;
int intervalPot = A3;


//Parameters
int focusDelay = 800;
int shutterDelay = 800;
//int interval = 20000;
int maxInterval = 600000; //Max interval between shots in millis allowed
int maxAmount = 1000; //Maxium amount of shots allowed

const int minLight = 40;        // at or below this light level, use minimum backlight intensity
const int maxLight = 900;        // at or above this light level, use maximum backlight intensity
const int minBacklight = 20;      // lowest backlight intensity to use
const int maxBacklight = 255;    // highest backlight intensity to use

int LDRRead = 0;         // value read from the LDR
int outputValue = 0;     // value output to the PWM (analog out)

int intervalRead = 0;         // value read from the interval pot
int amountRead = 0;         // value read from amount of photos pot

int interval = 0;
int amount = 0;





// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {

  //Set up LCD
  lcd.begin(16, 2);
  delay(100);

  //Set up pins
  pinMode(focusPin, OUTPUT);
  pinMode(shutterPin, OUTPUT);
  pinMode(shutterLED, OUTPUT);
  pinMode(LCDBackLight, OUTPUT);
  pinMode(enterButton, INPUT);
  pinMode(pauseButton, INPUT);


  //enable pull ups on buttons
  digitalWrite(enterButton, HIGH);
  digitalWrite(pauseButton, HIGH);


}


void loop(){


  int shots = 0;

  // LDR controlled LCD backlight via PWM part
  int sum = 0;
  for (int i=0; i<16; i++) // take 16 samples from the analog input
  {
    sum += analogRead(LDRPin);
  }
  LDRRead = sum/16; // divide by the amount of samples for the average value

  // map it to the range[0..255] of the analog output that the LCD backlight it connected to
  outputValue = LDRRead/4;   // alternative to map function for scaling down from analog input
  outputValue = map(constrain(LDRRead, minLight, maxLight), minLight, maxLight, minBacklight, maxBacklight );

  // change the analog out value to adjust LCD backlight intensity
  analogWrite(LCDBackLight, outputValue);   



  // read interval from pot
  intervalRead = analogRead(intervalPot);
  interval = map (interval, 0, 1023, 0, maxInterval);

  // read amount from pot
  // amountRead = analogRead(amountPot);
  //amount = map (amount, 0, 1023, 0, maxAmount);

  amount = 10;


  lcd.setCursor(0,0);
  lcd.print("Shots:");
  lcd.print(amount  );

  lcd.setCursor(0,1);
  lcd.print("Delay:");
  lcd.print(interval  );



  digitalRead(enterButton);



  if (enterButton == LOW);
  {

    while (shots < amount)
    {


      lcd.setCursor(0,0);
      lcd.print("Shots:");
      lcd.print(amount);
      lcd.print("/");
      lcd.print(shots + 1  );

      //Trigger focus
      digitalWrite(focusPin, HIGH);
      delay(focusDelay);

      //Trigger shutter
      digitalWrite(shutterPin, HIGH);
      digitalWrite(shutterLED, HIGH);
      delay(shutterDelay);
      digitalWrite(shutterPin, LOW);
      digitalWrite(shutterLED, LOW);
      digitalWrite(focusPin, LOW);

      delay(interval);


      shots++;
    }



  }

  if (enterButton == HIGH);
  {
    //do nothing
  }
}



390  Using Arduino / Project Guidance / Re: HELP Please - Idiot Dad tells his kid he can make a rocket launcher with a Ardui on: May 24, 2012, 08:34:23 pm
I cant add much knowledge to the project, but well done its looking great!
Pages: 1 ... 24 25 [26] 27 28 ... 39