0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ESP32: LEDの制御の簡単な例 (PWM)

Posted at

プログラム

ledc_ex03.ino
// ---------------------------------------------------------------------
//	ledc_ex03.ino
//
//						Aug/19/2024
// ---------------------------------------------------------------------
#define HAPTIC_PWM_BITS     8
int ledpins[8] = {32,33,25,26,27,14,12,13};

void setup() {
	int freq = 175;

for (int it=0; it<8; it++)
	{
	pinMode(ledpins[it],OUTPUT);
	ledcAttach(ledpins[it],freq,HAPTIC_PWM_BITS);
	}
}

// ---------------------------------------------------------------------
void loop() {
	int pattern[8] = {16,32,64,256,64,32,16,0};

	for (int it=0; it<8; it++)
		{
		for (int jt=0; jt<8; jt++)
			{
			ledcWrite(ledpins[it],pattern[jt]);
			delay(250);
			}
		delay(250);
		}
}

// ---------------------------------------------------------------------
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?