Society of Robots - Robot Forum

Software => Software => Topic started by: icoms8 on August 16, 2009, 03:39:17 PM

Title: sensor storage data?
Post by: icoms8 on August 16, 2009, 03:39:17 PM
Im trying to understand the basics of c++ and i want to run a photoresister on the adrunio, but i dont know the code that stores data. Can some one tell me it or give me a site that has the basic codes on it?
Title: Re: sensor storage data?
Post by: SmAsH on August 16, 2009, 03:42:35 PM
so you want to store the sensor reading in memory?
Title: Re: sensor storage data?
Post by: icoms8 on August 16, 2009, 03:54:44 PM
well i dont know. All im doing is use the if stament so if its dark a led turns on.
Title: Re: sensor storage data?
Post by: SmAsH on August 16, 2009, 04:04:56 PM
then thats easy,
IF photo resistor pin<threshold
led pin high...
Title: Re: sensor storage data?
Post by: icoms8 on August 16, 2009, 04:20:46 PM
sorry im asking such stupid questions, but what is threshold?
Title: Re: sensor storage data?
Post by: Razor Concepts on August 16, 2009, 04:45:02 PM
Well threshold is a range where something can occur. In this case, the threshhold values are values that you consider to be dark.
Title: Re: sensor storage data?
Post by: wil.hamilton on August 16, 2009, 04:59:45 PM
about thresholds:

say your sensors reads values between 1 and 100.
you point it at a white floor and it reads 90 you point it at a black line on the floor (say electical tape) and it reads 20
a good "threshold" between the two values would be 55

as for storing values
you could always store the value in a variable

something like this:
Code: [Select]
sensorValue = readSensor();

you can then use sensorValue for whatever you want