| Arduino Forum ::  Members :: taz3m
 Show Posts Pages: 1 ... 3 4 [5] 6 7
 63 Using Arduino / Programming Questions / Re: need help to modify this push button code on: January 19, 2013, 03:38:22 pm May be something like this may help to see things clearer :Code://definition of Variables int State = 0if (ButtonState==1)    {State = 1}Then in your code you define at State = 1, what happen depending on your requirements.taz . .
 64 Using Arduino / Programming Questions / Re: LDR reading to lux conversion. on: January 10, 2013, 01:39:08 pm Is there any look up table, already up for the lux values .. ?? Callibration is quite tough to be doing.. as its difficult to get a lux meter..Back to the above equation ... if i need some greater values for the Vout at night, i.e. a bigger range than 0.31, should i render my circuit more sensitive,do i need to change the fix resistor to 100 k ohms or less ??any clarification please .. ?\thankstaz...
 65 Using Arduino / Programming Questions / Re: LDR reading to lux conversion. on: January 10, 2013, 01:15:02 am Hello,The link to the sensor is quite nice, but i shall stick to the simple LDR, cause i shall be doing some switching only for some LIghts when sunset occurs.Moreover i want to display this value on an LCD, like i displayed % soil moisture and now some light reading.Quote from: holmes4 on January 09, 2013, 03:09:02 pmWhy are you converting to lux. In fact why convert anything when you can use the sensor value directly.I think it is more appropriate to display Lux reading on an LCD instead of ADC value to the people around . .  Thankstaz ..
 66 Using Arduino / Programming Questions / Re: LDR reading to lux conversion. on: January 10, 2013, 01:01:55 am Hello,RegardsQuote from: johncc on January 09, 2013, 02:33:33 pmCode:    ADC = analogRead (LDR_input);    RLDR = (10000.0 * (5 - Vout))/Vout;     // Equation to calculate Resistance of LDR, [R-LDR =(R1 (Vin - Vout))/ Vout]   // R1 = 10,000 Ohms , Vin = 5.0 Vdc.                                           Vout = (ADC * 0.0048828125);           // Vout = Output voltage from potential Divider. [Vout = ADC * (Vin / 1024)] I will try to swap the lines, i.e make the Arduino calculate the Vout first and then RLDR, this quite make some sense, but sometimes we do not see it when we are just coding.  Quote from: PaulS on January 09, 2013, 02:34:30 pmHave you got something against compact code?Code:   int ADC = analogRead (LDR_input);   .. i will try to stick to compact mode now . .  Code:  RLDR = (10000.0 * (5 - Vout))/Vout;     // Equation to calculate Resistance of LDR, [R-LDR =(R1 (Vin - Vout))/ Vout]And what value does Vout have? Dividing by 0 is not generally a good practice.At night in the room with light on, i could get only 0.31 Volts reading from serial monitor as well as from voltmeter.Do i need to adjust the fixed resistor so as to get more coherent values for the Vout and less trouble for the Arduino to compute ??Actually im using a 10 K ohms resistor with the potential divider circuit . .Any views ?Thanks