Arduino duemillanove and ubuntu 9.10

Hello everyone

I am trying to make an electronics project using the Arduino software for ubuntu, for compiling my c code. But when i upload to the device, it somehow doesnt work as i want it to. The buttons that i have connected to the digitalinputs and the Led's that i have connected to the digitaloutputs that i have defined dont work well.. When i push one of the buttons, BOTH of the led's light up, although they have different output pins...

This is my code: int pzerob = 0; int bzeroc = 0; int opbzero = 1; int ptwob = 2; int btwoc = 0; int opbtwo = 3;

void setup() { Serial.begin(9600); pinMode(pzerob, INPUT); pinMode(ptwob, INPUT); pinMode(opbzero, OUTPUT); pinMode(opbtwo, OUTPUT); }

void loop() { bzeroc = digitalRead(pzerob); btwoc = digitalRead(ptwob);

if (bzeroc = HIGH) { digitalWrite(opbzero, HIGH); }

if (bzeroc = LOW) { digitalWrite(opbzero, LOW); }

if (btwoc = HIGH) { digitalWrite(opbtwo, HIGH); }

if (btwoc = LOW) { digitalWrite(opbtwo, LOW); } }

Hope someone can help me out...

Lungefisk

This isn’t a hardware problem, and has nothing to do with Ubunto. Two strikes.

Then, you posted code without using the # button. Third strike. You’re out.

The problem is this code:

 if (btwoc = LOW)

I think you wanted:

 if (btwoc == LOW)

Your code was valid. btwoc was set to LOW. That operation returned LOW, which the if considered false.

The other statements with = and HIGH return HIGH which if considers true.

The == is the comparison operator.

Thankyou very much... doh!