is Arduino Nano able to produce an voltage.level at his pins,i.e. A1 ?
googling for this issue didnt find fitting threads ..
in detail &:
ardiuno should produce a voltage analog to an programmed value
for a bargraph-led-array.
the bargraph is connected to LM3914 , which lights the 10 led's analog
to an input level, which should be delivered by arduino.
but independent of the generated value, nothing is recognized at A1, the
voltage level at A1 remains on 0,3mV measered with an electronic multimeter.
i tried with analogWrite in this code
//- test_bargraph_1
//- Testen einer Bargraph-Anzeige von Zäaehlerstand (Achenzaehler)
//- Stand : 23.09.2021
#define LOOP_DELAY 400
static int counter = 0;
int pin_bgraph = A1; //-25;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(pin_bgraph, OUTPUT);
counter = 0;
analogWrite(pin_bgraph,counter/10);
}
void loop() {
// put your main code here, to run repeatedly:
counter = 0;
while(counter < 10)
{
counter++;
analogWrite(pin_bgraph,counter/10);
Serial.println(counter);
delay(LOOP_DELAY);
}
Serial.println("MAX");
while(counter > 0)
{
counter--;
analogWrite(pin_bgraph,counter/10);
Serial.println(counter);
delay(LOOP_DELAY);
}
Serial.println("MIN");
}
the LM3914 "LEd-bar-controller" doesnt accept PWM - not any reference to pwm
in its datasheet !
It gets really analog voltage one can adjust with potentiometer..
use switch(counter)..case...
in simple way one could build this for 10 leds easily counting up to 10 objects
more tricksy to do this "digital" means &:
switch(counter)
case = 1
..LED1
case = 2
LED1+LED2
case > 3
LED1+LED2+LED3
case > 7
LED1+LED2+LED3+LED4
case > 15
LED1+LED2+LED3+LED4
and so far..this way one could count up to 2 ^ 10 = 1024 objects
what i want to do is counting cars on special range of model-railway
i.e. to check out situations in a tunnel or underground station
if we limit the amount of cars i.e. to 15 we need only 5 LED's
this way could check up to 3 different ranges =15 LED's
what Arduino could handle easily..
Do I presume you want to do this with only one I/O pin?
Eh? How do you propose to count up to 15 objects using 5 LEDs? Binary?
A 74HC4017 will drive 10 LEDs (with resistors) using two I/O pins - count and reset. You just reset it and pulse it a given number of times to select which one of the ten outputs is HIGH.
One or other of the outputs will always be HIGH or you could use the I/O driving the reset line as the common return for the LEDs, using just one resistor to blank all LEDs when held HIGH.
i see myself as newbie to arduino..
so I have trouble to understand function the A0..A7-Pins A0..A7 (26..19)
of NANO !
with Pins D2..D12 (5..15) there is no problem to switch LED's with
digitalWrite(..)
but this does NOT work with the 'Analog'-PINS A0..A7
no difference whether use
analogWrite(25, HIGH),
analogWrite(25, 200.0),
digitalWrite(25, HIGH)
it does nothing !
just found this in this forum
"
The A/Analog ports on an Arduino are Analog inputs on most Arduino's. The name analogWrite() is still pretty confusing but it applies to the PWM capable pins. Really whished they called it pwmWrite()." by septillon
ok, then i have to modify usage of pins after checking whether 2 pins of A0..A7 can receive the signals from light-sensors
which act to count the cars as described earlier in this thread
hope you understand my bad english writing..did not find all translations in german-english-dictionary, sorry !
so i can write it more correctly and better describe my goal &:
on my model-railway cars are recognized by reflection light barriers
there are 2 of this for every section, one counting up and one counting down.
so if the difference is not zero, then one or more cars remained in the section.
if this is a fault, arduino should give alarm signal and perhaps act otherwise..
There will be problems reliably counting railway cars, due to movement, odd reflection angles and such. You will have to take that into account.
The common request here is a means to count the number of people in a room, exposing the difficulty of reliably counting those entering and exiting. Railway cars may be much more constrained, but there will still be difficulties.
ok,
the light barrier sensors do their jobs already on my modelroad
(N-Gauge , Scale 1:160)
as Funicular Railway, they detect running cars effectively ,
but this was built without Arduino..
so in the moment i am optimizing reading them with Ard.