Author Topic: sensor storage data?  (Read 1359 times)

0 Members and 1 Guest are viewing this topic.

Offline icoms8Topic starter

  • Full Member
  • ***
  • Posts: 57
  • Helpful? 0
sensor storage data?
« 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?

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: sensor storage data?
« Reply #1 on: August 16, 2009, 03:42:35 PM »
so you want to store the sensor reading in memory?
Howdy

Offline icoms8Topic starter

  • Full Member
  • ***
  • Posts: 57
  • Helpful? 0
Re: sensor storage data?
« Reply #2 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.

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: sensor storage data?
« Reply #3 on: August 16, 2009, 04:04:56 PM »
then thats easy,
IF photo resistor pin<threshold
led pin high...
Howdy

Offline icoms8Topic starter

  • Full Member
  • ***
  • Posts: 57
  • Helpful? 0
Re: sensor storage data?
« Reply #4 on: August 16, 2009, 04:20:46 PM »
sorry im asking such stupid questions, but what is threshold?

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: sensor storage data?
« Reply #5 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.

Offline wil.hamilton

  • Robot Overlord
  • ****
  • Posts: 207
  • Helpful? 6
  • rtfm
Re: sensor storage data?
« Reply #6 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
use the google.  it's your friend.

 


Get Your Ad Here