input from my computer to my arduino for testing purposes

hello everyone,

noob alert to start with,

i have this piece of code

// Maurice Ribble
// 4-9-2008
// http://www.glacialwanderer.com/hobbyrobotics

// This code just lets you turn a digital out pin high for a short time.
// That's all that is needed to verify the flash circuit is working.
// Press the space bar to trigger the flash.

#define CAMERA_FLASH_PIN 4

void setup()
{
  pinMode(CAMERA_FLASH_PIN, OUTPUT);
  digitalWrite(CAMERA_FLASH_PIN, LOW);
  Serial.begin(9600); // open serial
  Serial.println("Press the spacebar to trigger the flash");
}

void loop()
{
  int cmd;

  while (Serial.available() > 0)
  {
    int cmd = Serial.read();

    switch (cmd)
    {
    case ' ':
      {
        digitalWrite(CAMERA_FLASH_PIN, HIGH);
        delay(100);
        digitalWrite(CAMERA_FLASH_PIN, LOW);
        break;
      }
    default:
      {
        Serial.println("Press the spacebar to trigger the flash");
      }
    }
  }
}

all i need to know from this now is where is the console for interaction with my arduino, where do have to be when i press the space bar for this to actually trigger the arduino???

thanks all so much,

all i need to know from this now is where is the console for interaction with my arduino, where do have to be when i press the space bar for this to actually trigger the arduino???

On the IDE, there is an icon that says "Serial Monitor" when you hover over it. Press that.

You will need to enter a space, then hit the send button.

thank you so much worked like a charm,

next up, since it still didnt work, i am uploading a photo of the progress, high res so one can see the details yet anyway i will say what i did

5V connected to + (thats the positive right?)

gnd to ground line (doesnt matter where right?)

digital pin 4 to leg 1

leg 2 connected with the resistor, then resitor to the ground line

and legs 3 and 4 from the opto connected to the flash

so cld it be that opto is screwed or is it my connections???

here’s the photo

thnx

leg 2 connected with the resistor, then resitor to the ground line

What value? It looks like a 47R and that is too low, should be at least 100R probably 220R.

What is the part number for the opto isolator, have you got the legs right?

How do you know what way round to connect the output of the opto isolator to your flash?

I believe it is a 47r, the diagram where i got this from asked for that and it worked with others, here’s a photo just in case too

on the other hand, the number is NEC 2532, reading the part number right, i put them in this order

4 3
NEC 2532
1 2

so i believe the legs are right if this is how they should be treated…

as for the third question, i tried both lines, but here is where i got the tutorial from

http://www.glacialwanderer.com/hobbyrobotics/?p=10&cpage=1

thanks again

I believe it is a 47r, the diagram where i got this from asked for that and it worked with others,

Yes but a value of resistor that size overloads and damages the arduino output. It will draw 80mA out of the arduino's pin, this is twice as much as the amount of current to cause damage(40mA), so while it might work in the short term it is killing your arduino. It is also bang on the absolute ratings for the opto coupler so it is not doing that much good either.

That post you linked says he is using a 10K series resistor on the camera side. Have you tried swapping the output side connections?

ill get a resistor tomorrow then, should i get both u think or just the 220?

where did u see the 10k resistor? its in the diagrams or the photo or both?? :S where should i hook that up?

and what do u mean by swapping the output connections? if you mean the ones going to the flash, i did try that but it still doesnt work…

could the optoisolator be damaged for any reason ? and is there a wway to test it if it is?

much appreciated for ur time

cheers mate

I got the 10K from the last exchange in the page you linked:-

You are absolutely correct. I found this out about 2 hours after I posted the question. This is now working like charm. I know have the optocoupler connected to the output of the arduino with 50 ohms in series with it. I have a camera connected with 10k ohms resistors in series and it is controlling a camera. I now have time lapse photography.

could the optoisolator be damaged for any reason?

Yes

and is there a wway to test it if it is

Yes wire up an LED with the cathode to pin 4, then the anode to a 1K resistor and the resistor to +5V, and connect pin 3 to the arduino ground. If all is working you should see it light up when you output a logic high on the arduino pin.

Many apologies for my nubeness, but how do u exactly output a logic high,

and mike, I hope I am not pushing it, but i really looked all over the post about the 10k and couldnt find it, Ctrl-F or any way else, it's just not there. I got the 10k anyway, and i got a new optocoupler just in case i already messed that one up (it also didnt have legs the previous one so it was a bother), part number is 817a, but it basically is the same, I will try to assemble yet again tonght, but wld appreciate answers to the above questions

i bow before u, thank you once again

but how do u exactly output a logic high,

digitalWrite(somePin, HIGH);