Hello, I am Hartmut and I have a little question. Can you help me with my program to write it because I unfortunately cannot do it alone?
I am supposed to create a program in arduino which has a switch-on time of 40 ms and switches off the LED after 15 light pulses
Here is my previous code
void setup ()
{
DDRC | = 1 << PC4; // PC4 as data output for LED
}
// ------------------------------------------------
void loop ()
{
PORTC | = 1 << PC4; // PC4 log 1, LED off
delay (160); // wait 160 ms
PORTC & = ~ (1 << PC4); // PC4 log 0, LED on
delay (40); // wait 40 ms
}
Thanks in advance
Also, why are you using direct port manipulation, is that part of the "you have to" ?
The Arduino IDE comes with examples, and 99.99 % of the Arduino and its clones come with the first example pre-loaded.
The first example is blink.ino, and it almost does what you have to do.
All you need to do is to alter timing a bit and to count.
Can't be too hard to figure out i'd say.