I need a program for the Arduino where the value of the light intensity, measured on an analog input pin of the Arduino, is used as the upper limit for the PWM modulation of your two LEDs. The LEDs are modulated in opposite directions.
The modulation thus affects between minmod and maxmod, where the value of maxmod is determined by a measured value from one of the analog ports of the Arduino.
The more light there is, the larger maxmod becomes and the slower the modulation.
The less light there is, the smaller maxmod becomes and the faster the modulation.
At the beginning of the program, you even turn on both LEDs to see if they work.
In the course material you will find the instructions for reading an analog port on the Arduino.
Thanks for the fast reply's. Well i have another 1 week but i have been struggling for a long time to get this arduino course done (part of my education, which i will never use again probably) so i'm asking the internet for help... all i have now is this code:
int maxmod = 200;
int minmod = 10;
int modulatie = 0;
int tegenmodulatie = 0;
Perhaps you ought to start by reading...
File => Examples => 03. Analog => Analog Input
Or indeed...
In the course material you will find the instructions for reading an analog port on the Arduino.
Not sure what those for loops are all about? Just 2 analogue writes are needed, one for each pin.
You just need to map the analog value read from the analogue input to the required range.
There's even an Arduino function specifically for that... map()