Are These Two Identical

Hey guys today i was messing around with Arduino IDE and i really wonder if

analogWrite(pin, 255);

and

digitalWrite(pin, HIGH);

Are identical and i cant measure the outputs because i do not own a oscilloscope

Thanks.

Yes, they are identical (at least on an AVR)

Got a multimeter? Both will measure a static 3.3V or 5V depending on your hardware.

From wiring_analog.c

void analogWrite(uint8_t pin, int val)
{
	pinMode(pin, OUTPUT);
	if (val == 0)
	{
		digitalWrite(pin, LOW);
	}
	else if (val == 255)
	{
		digitalWrite(pin, HIGH);
	}
	else
	{
           ...
           ...