Show Posts
|
|
Pages: [1]
|
|
1
|
Using Arduino / Project Guidance / Lie Detector
|
on: February 02, 2013, 12:00:50 am
|
|
The three main things the group wants to measure is heart rate, skin conductivity, and breathing rate. Heart rate will be monitored using a pulse sensor. Skin conductivity will be measured using a GSR sensor. And, breathing rate will be measured using a thermistor. Using these three measurements simultaneously, we are hoping to be able to consistently detect a liar with conclusive results.
|
|
|
|
|
3
|
Using Arduino / Programming Questions / Re: Multiple Blink States with a button no delay
|
on: January 31, 2013, 11:48:14 pm
|
|
Also, I am trying to add three more LEDs (a total of four) to do the following: • Program the circuit to include 5 light states, detailed below. There should be no response delay in the circuit and you should use a debounce check. o State 0: All LEDs off o State 1: After the button is pressed the first time, one LED (referred to from here on as Light 1 (pin 10) turns on and remains on until the button is pressed again. o State 2: Immediately after the button is pressed the second time Light 2 (pin11) should turn on as Light 1 goes off. In this state the lights should turn on and off according to the pattern in Table 1.
Table 1 - State 2 Light Pattern Time (sec) Light 1 Light 2 0 Off On 0.5 On On 1.0 Off Off 1.5 On Off 2.0 Repeat Pattern
o State 3: After the button is pressed the third time, Light 3 (pin 12) immediately turns on and Lights 1 and 2 are off. In this state the lights should turn on and off according to the pattern in Table 2.
Table 2 – State 3 Light Pattern Time (sec) Light 1 Light 2 Light 3 0 Off Off On 0.5 On Off Off 1.0 On On Off 1.5 On On On 2.0 Off Off Off 2.5 Repeat Pattern
o State 4: Create a custom light state that does the following after the fourth button press and continues until the fifth button press: Utilizes all 4 LEDs Has a repeating blink sequence of at least 4 time steps o State 0: After the fifth button press, the code should revert back to State 0.
|
|
|
|
|
4
|
Using Arduino / Programming Questions / Multiple Blink States with a button no delay
|
on: January 31, 2013, 11:27:35 pm
|
|
My TA does not know what is going on. I am trying to modify this code so that the LED is off initially, I press the button once the led comes on, I press it once more, and the LED blinks with one second intervals, then the process repeats.
const int switchPin = 2; const int ledPin = 13; int buttonstate; int lightState; int blinkstate = LOW; long previousmillis = 0; long interval = 1000; unsigned long currentmillis = 0;
// the setup routine runs once when you press reset: void setup() { pinMode(switchPin, INPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); buttonstate = digitalRead(switchPin); }
void loop() { int val = digitalRead(switchPin); delay(10); int val2 = digitalRead(switchPin); if (val == val2){ if (val != buttonstate) { if (val == LOW){ if(lightState == 0){ lightState = 1; Serial.println("Button just pressed, Blinking"); currentmillis = 0; previousmillis = 0; blinkstate = LOW; } else{ lightState = 0; digitalWrite(ledPin,LOW); Serial.println("Button just pressed, light off"); } } } } // Blinking Section if (lightState == 1){ currentmillis = millis(); if (currentmillis - previousmillis > interval) previousmillis = currentmillis; if (blinkstate == LOW) blinkstate = HIGH; else blinkstate = LOW; digitalWrite(ledPin,blinkstate); } buttonstate = val; }
--Thanks
|
|
|
|
|