Interfacing with Glocal Camera Trigger

Hey Im trying to interface with the Glocal Camera trigger, basically another arduino with a opto switch for triggering a camera with sound. I have connected one wire from the switch to ground and one to digital input 10. Hoever all i get is 111111111111..... in the serial viewer. Can anyone help me out?

int timer = 100; // The higher the number, theslower the timing.
int pins[] = {2, 3, 4, 5, 6, 7, 8, 9}; // an array of pin numbers
int num_pins = 8; // the number of pins (i.e. the length of the array)
int inPin = 10;
int val = 0;
void setup()
{

Serial.begin(9600);
pinMode (inPin, INPUT); //sets the digital pin 10 to input
digitalWrite (inPin, HIGH);

int i;
for (i = 0; i < num_pins; i++) // the array elements are numbered from 0 to num_pins - 1
pinMode(pins*, OUTPUT); // set each pin as an output*
}
void loop()
{
val = digitalRead(inPin);
Serial.print(val);
int i;
if (inPin = HIGH) {

  • for (i = 0; i < num_pins; i++) { // loop through each pin...*
    _ digitalWrite(pins*, HIGH); // turning it on,_
    _
    delay(timer); // pausing,_
    _ digitalWrite(pins, LOW); // and turning it off.
    }
    }
    else if (inPin = LOW) {_

    for (i = num_pins - 1; i >= 0; i--) {
    _ digitalWrite(pins, HIGH);
    delay(timer);
    digitalWrite(pins, LOW);
    }
    }
    }*_

I think you should change

if (inPin = HIGH)  {

to

if (inPin == HIGH)  {

Thanks but this doesnt fix my problem.

and also, of course, else if (inPin == LOW) {
or even, simply "else"
Please use the "Code" (#) button when posting code.

Of course, that doesn't help that your switch doesn't appear to be working.
Have you tried a wire from ground to pin 10?

Ok, did that. But I still cant interface the two together. Here is the glocal camera trigger shematic link.

http://www.glocal.ca/downloads/glocal_camera_trigger_june26_08.zip

I tired to ground Pin 10 and it goes to LOW or 0000000000.....

No, sorry, I don't open zips of unknown provenance.
So, your switch isn't working.
Your software looks sound, with the corrections noted.

can i post the picture? How do I do this?

Use the "Insert image" button, third from left.

Nope, nothing there that I can see - have you used a valid URL, and not just a pathname on your own machine?

just a pathname on your own machine?

Looks like he used its local path indeed ;D

@ Codabear, you have to upload the picture to a online webspace like imageshack or so...

ok so heres the schematic. Anyone have any ideas. Thanks forum :slight_smile:

I found the problem. Well you guys did.... it was the switch it was badly soldered. Now I get 1111111...... when the switch is not in use and a 000000000...... when it is.

THANKS FOR THE QUICK REPLY THIS FORUM ROCKS ;D