Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: a problem with the loop section of the sketch on: October 09, 2011, 04:36:25 pm
I'll try, thanks.
2  Using Arduino / Programming Questions / a problem with the loop section of the sketch on: October 09, 2011, 04:24:57 pm
hi guys, I program the atmega328 through duemilanov and from some reason when I put few functions in the loop section, only the first function does work.
tried to put these functions all together in the setup section and then everything works just great.
why is that?
by the way, tried to put all the functions in a general function and enable that general function that includes the wanted functions, but the same happens again..


here is the problematic code:
(tried here to put both the functions all together in the same function - these two functions are two for loops.. and just the first loop does work and the second doesn't.)

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;



void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void gamba()
{
    // count from 0 to 255 and display the number
  // on the LEDs
  for (int numberToDisplay = 0; numberToDisplay < 32768; numberToDisplay++) {
    // take the latchPin low so
    // the LEDs don't change while you're sending in bits:
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay >> smiley-cool;
    shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay); 

    //take the latch pin high so the LEDs will light up:
    digitalWrite(latchPin, HIGH);
    // pause before next value:
    delay(1);
  }
 
  delay(1000);
  for(int f=0;f<6;f++)
  {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 65535 >> smiley-cool;
    shiftOut(dataPin, clockPin, MSBFIRST, 65535);
    digitalWrite(latchPin, HIGH);
  }
  delay(1000);
}

void loop() {
 gamba();
}
3  Using Arduino / General Electronics / Re: Hi guys, question about driving something by mP on: August 23, 2011, 02:23:47 pm
just to make sure, I want to use the transistor exactly like realys been used.
pretened for yourselves there is a rellay that Is controlled by the mP and once, the rellay enable the trimmer so the current will pass through it, and once it doesn't allow the current to pass through that trimmer.
That's it, all the difference is in the part. instead of using a rellay, I want to make it happen with a transistor.

I still wait for any kind of an answer.
please help.
4  Using Arduino / General Electronics / Re: Hi guys, question about driving something by mP on: August 23, 2011, 01:38:53 pm
sorry for my mistake,
It's a NPN one and V2 is about 2.5v while V1 is connected where the voltage is 1.6v .
5  Using Arduino / General Electronics / Hi guys, question about driving something by mP on: August 23, 2011, 12:15:33 pm
Hi friends,
I have tried to drive a usual trimmer by a microcontroller with an NPN transistor but from some reason, it doesn't work!!!!
Here take a look:

V2>V1
My goal is to control this trimmer that is located and connected on another circuit with that microcontroller.
By this arrengment I tried to use the transistor as a switch and decide when I want the current to pass through the trimmer and when I don't.
But from some annoying reason, it doesn't happen, it doesn't work!!!
please help.

P.S
the way I tried to make it work is just to send "1" logic to the transistor and in that way to cause the transistor to pass the current through the trimmer (to connect the trimmer to the rest of the circuit).


Thanks in advanced,
Have a nice week,
Ami.
6  Using Arduino / Motors, Mechanics, and Power / Re: Hello people, I need some help about finding a specific part on: February 08, 2011, 03:58:57 pm
ok, if I'm talking about the simplest two motors that are connected. they both got one joined connection, while the other connections aren't.
in this situation, will it work? (this motors work on AC, they are the simplest you can find, nothing special).
7  Using Arduino / Motors, Mechanics, and Power / Re: Hello people, I need some help about finding a specific part on: February 08, 2011, 03:05:26 pm
well, let's say I have two motors that have a common Power connection and two grounds (two motors).
Will your circuit work in such a situation?

and about the last thing..
I mean that the triac conducting current when there's dc in his first side and ac in his second side.
From what I see, we switch the motors' grounds, that means we don't deal with power, however, zeros, grounds!
So if I'm right, the triac can't work in such a way.
8  Using Arduino / Motors, Mechanics, and Power / Re: Hello people, I need some help about finding a specific part on: February 08, 2011, 02:42:24 pm
are you sure its gonna work?
I think there's something unclear somewhere in your circuit..

P.S
Don't forget the triac works when the AC comes to his gate and goad his state (for example, goads it to stay on conducting status) while here it's connected to grounds, from both sides.
9  Using Arduino / Motors, Mechanics, and Power / Re: Hello people, I need some help about finding a specific part on: February 08, 2011, 01:55:16 pm
is there connection between the right triac and the resistor?
and can you give a simple explanation why and how this circuit will work?
Thanks a lot,
Sincerely yours, Ami.
10  Using Arduino / Motors, Mechanics, and Power / Re: Hello people, I need some help about finding a specific part on: February 08, 2011, 01:20:13 pm
can you draw it please?
I couldn't understand your explanation.
11  Using Arduino / Motors, Mechanics, and Power / Re: Hello people, I need some help about finding a specific part on: February 08, 2011, 01:01:01 pm
the rectangles are resistors, and the square is the moc3041.
and regarding the zeros - usually in this kind of circuit (with zero crossing circuit) you have a consumer with two connections to the AC power - one ground and one power.
and in this case I have a motor with one power connection and two grounds.
When I connect the power and the first ground it rounds forwards, when I connect the power and the second ground, it rounds backwards. In my case, I need to switch between the grounds while the power connection is permanently connected to AC.
For one motor I have got two such a circuits, everyone of them is connected to one Ground. the first circuit connected to GND1 and the second circuit connected to GND2.
when I send dc to moc3041, it opens the gate of the triac that is placed after the moc3041.
but the gate stays open while it gets Alternating Current, but in my solution, I control between grounds, that's why I think the gate won't stay opened (the motor won't spin).
12  Using Arduino / Motors, Mechanics, and Power / Hello people, I need some help about finding a specific part on: February 08, 2011, 12:43:17 pm
Hi readers,
I need a part that works like a relay, but doesn't have the mechanical part.
I thought about the combination of moc3041 and triac mac212, but it doesn't work because I have to control and switch between grounds, zeros.

like you see, the red lines have no 1, however, they are always on 0, that causes that this circuit doesn't work when there comes 1 logic into the moc. (The zero crossing circuit in the moc always search for that 0 to stop the power conduction of the triac (mac212)).
That's why probably this circuit will falter.
So I ask you a lot, please help me to find another solution for this purpose (and don't say me to use relays, I don't want).

Thanks a lot,
Sincerely yours, Ami.
13  Using Arduino / Programming Questions / Re: Receiving a binaric word from serial port on: February 01, 2011, 07:56:25 am
well, first thanks for the help.
Secondly, I don't think I will use all of the combinations of the byte, but these 8 bits are what I have, nothing less or more...
Correct me if I'm wrong.
well, I want to define few binaric words and when I receive one of them from the serial port, according to my desicion, a specific device will start to work. this will happen with everyone of the 9 words I'm going to define in a program on the computer.
For example if this is part of what I defined:
01100100 - X move forwards
01110100 - X move backwords
01000100 - X doesn't move
so when the AT328 gets the first byte, it's gonna move the engine forwards, when it gets the second byte, it's gonna stop from moving and so on...
what do you think about that?
(That's mean I will have 9 words to control the engines, 3 for each engine)
14  Using Arduino / Programming Questions / Receiving a binaric word from serial port on: February 01, 2011, 04:26:16 am
Hello Readers,
I have got a question to you,
How can the AT328 or AT168 receive a binaric word made of 8 bytes that sent from the RS-232, the serial port of the computer (COM port)?
What I want to do is to send a word to the AT328 or AT168 from the serial port (for example: 01001100) and accordingly to what I defined in the program (specific word will cause the processor send "0" and another word cause it to send "1" logic) make the processor sending "1" or "0" from one of his outports.
all of that is for controlling engine to move forward or backwords or not to move at all according to the word was sent from the COM port.
By the way, the engine works on three outputs: VCC and two GNDs. when I take the VCC and the first GND it moves forwards, when I take the VCC with the second GND, it moves backwords.

Thanks in advanced.
Pages: [1]