Help, First code, Flip Flop T

HI, Im trying to implement a Flip Flop T, but all i got is a blinking led :frowning: here is the code, Help me Pleaseeeeeeeeeeeeeeeeeeeeeeee XD

Im trying to implement a Flip Flop T

No idea what a Flip Flop T is. Please explain.

but all i got is a blinking led

Because that is what you coded.

How is your switch wired? Why aren't you using the internal pullup resistor?

Here is the code. It isn't tested, but compiled OK

#define button 8
#define Q 13
#define Q_ 3


boolean stat;

void setup(){
  
  pinMode(Q, OUTPUT);
  pinMode(Q_, OUTPUT);
  pinMode(button, INPUT);
}

void loop(){
  if (digitalRead(button) == true) {
    stat = ~stat;
    digitalWrite(Q, stat);
    digitalWrite(Q_, ~stat);
  }
  
  while(digitalRead(button) == true);;
  delay(100);
}

PaulS:

Im trying to implement a Flip Flop T

No idea what a Flip Flop T is. Please explain.

but all i got is a blinking led

Because that is what you coded.

How is your switch wired? Why aren't you using the internal pullup resistor?

Jeje it´s my first code, i usually use Fpga, Only want to learn, here is the description of the Flip Flop Flip-flop (electronics) - Wikipedia

buracek:
Here is the code. It isn't tested, but compiled OK

#define button 8

#define Q 13
#define Q_ 3

boolean stat;

void setup(){
 
  pinMode(Q, OUTPUT);
  pinMode(Q_, OUTPUT);
  pinMode(button, INPUT);
}

void loop(){
  if (digitalRead(button) == true) {
    stat = ~stat;
    digitalWrite(Q, stat);
    digitalWrite(Q_, ~stat);
  }
 
  while(digitalRead(button) == true);;
  delay(100);
}

O.O Thanks!!!! it's working fine! a little unstable but it's all i need :slight_smile:
Video! -> Join this room

Can any one please help me for D-Flip Flop?

Hi
http://forum.arduino.cc/index.php?topic=127169.0
also use the "search the arduino forum" window up and to the right on your screen
try
D type flip flop

Hope this helps.
Tom.... :slight_smile: