I looked online for the Arduino Uno (http://arduino.cc/en/Main/arduinoBoardUno) and it said "Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board." I'm trying to have the reset button able to be clicked to start the code again - here's what I have so far (I'm confused by what it means for "bring this line LOW"):
boolean status_button = HIGH
If (status_button == LOW)
I am trying to make it so that when a TTL pulse is sent to the arduino, the status_button goes to LOW which will make it ignore all the subsequent TTL pulses. Thanks!
boolean status_button = HIGH // indicates reset button hasn't been clicked yet?
int TTLpin = 0 // TTLpin is the 0 RX pin which will receive the TTL pulse from external device
If (status_button == HIGH)
digitalWrite(TTLPin, HIGH)
I'm a little confused where to add what - I want to have the button as "HIGH" until the first TTL is received by "TTLpin" which is the RX pin in the 0 spot. How would I go about the LOW statement then - for that I want the TTLPin to just ignore the TTL pulses coming through (after first TTL pulse)?
Sorry about that. I want to be able to have the arduino uno receive TTL pulses (a 5V pulse) from a spectrometer. The spectrometer can be set to keep outputting TTL pulses at a certain frequency (can be set) and then the arduino relays the first TTL pulse from the spectrometer to the LED controller, which triggers the LED controller code to run. Hope that makes it a little clearer. Here is the code I am going to use. Also, there will be a reset button to start the code over again so that all the TTLs are ignored after the first one until the button is pressed again.
int inputpin = 0; //defines the RX pin(0)
int outputpin = 1; //defines the TX pin(1)
pinMode(inputpin,INPUT); //sets the inputpin as the input for the TTL pulse
pinMode(outputpin,OUTPUT); //sets the outputpin as the output for the TTL pulse
digitalWrite(outputpin,LOW);
while (digitalRead(inputpin)==0) {} // code only will move on if statement is true
digitalWrite(outputpin,HIGH); //sets the pin to 5v
delay(1); //delay in milliseconds, this is time for output pulse
digitalWrite(outputpin,LOW);
while(true);
What do you think - does it match up with what I was saying?
You are talking about the RESET button on the Arduino Uno Board, right?
I've never done it, but i guess i would connect a button to it and use a pull-up resistor (you can read the data sheet to see if there is an internal pull-up on that pin...).
This way the pin will be HIGH when the button isn't pressed.
When you press the button, it would connect to ground, be LOW and so it would reset the board.