What is the difference between analogWrite() and digitalWrite()? I will show two different blocks of code that gave me the exact same output on my hardware. There are the codes;
int led=1, brightness=255;
pinmode (led, brighness);
digitalwrite(led, brightness);
and
int led=1;
pinmode(led, output);
digitalwrite(led, high);
When I write these codes I can change digital to analog and get the exact same results. Why is this? What is the difference? Is one preferable over the other?
and yes i know that half the code is missing and that there are no caps, but you should be able to understand what I'm trying to say.