A code for light pulse to control servo
hello new here , browsing forum ages now, need basic code build from, because have been trying coding , have no idea start. need pulse counter in combination analog sensor.
the idea light pulses send beamer , according frequency (which 1hz) servo reacts accordingly. sensor have ldr.
so situation ldr has value.
every second measured if value changes lot natural light + beamer light (value + threshold)
if changes counter count +1
every 5 seconds measured count
if 3 > servo go 90 degrees
if 4 > servo go 180 degrees
and counter reseted
i saw many different ways count don't know start.
great in advance!
the idea light pulses send beamer , according frequency (which 1hz) servo reacts accordingly. sensor have ldr.
so situation ldr has value.
every second measured if value changes lot natural light + beamer light (value + threshold)
if changes counter count +1
every 5 seconds measured count
if 3 > servo go 90 degrees
if 4 > servo go 180 degrees
and counter reseted
i saw many different ways count don't know start.
great in advance!
quote
so situation ldr has value.
you can read value using analogread.
quote
every second measured if value changes lot natural light + beamer light (value + threshold)
if changes counter count +1
use millis() see time is. record when take reading. see if enough time has elapsed need take reading.
if time take reading, so, , record time. if reading has changed significantly, increment (or decrement?) count.
quote
every 5 seconds measured count is
if 3 > servo go 90 degrees
if 4 > servo go 180 degrees
and counter reseted
use millis() see time is. record when last sent data. see if it time send again. if so, send value, set time, , reset count.
quote
the idea light pulses send beamer , according frequency (which 1hz) servo reacts accordingly.
can't this. have no idea beamer is, or how make send pulses, or pulses need send make servo move.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > A code for light pulse to control servo
arduino
Comments
Post a Comment