SKU_DFR0975_FireBeetle_ESP32_S3_Basic_Tutorial-DFRobot

[](Product Link)

1. Introduction

This tutorial introduces the basics of using FireBeetle ESP32-S3.
Click here to find more details about FireBeetle ESP32-S3.
Click here to view the advanced tutorial for FireBeetle ESP32-S3.
Click here to look for information about Arduino programming.

2. PWM Output

The PWM function of ESP32-S3 needs to be declared in advance.

Sample Code

The ESP32-S3 PWM can be freely mapped to other ports to output. The sample code below demonstrates the steps for configuring that. The LED will show a fade-in/fade-off effect when everything is set up.

/*LED fading example 
 * 
 */
const int ledPin = 21;  // Actual LED pin for outputting PWM signal 

//Setting PWM properties
const int freq = 5000;//PWM frequence 
const int ledChannel = 0;//Channel that generates pwm signal 
const int resolution = 8;//8-bit resolution 

void setup(){
  //Configure LED PWM functionalitites
  ledcSetup(ledChannel, freq, resolution);

  //Attach the channel to the GPIO to be controlled
  ledcAttachPin(ledPin, ledChannel);
}

void loop(){
  //LED fade in 
  for(int dutyCycle = 0; dutyCycle <= 255; dutyCycle++){   
    // changing the LED brightness with PWM
    ledcWrite(ledChannel, dutyCycle);
    delay(15);
  }

  //LED fade off
  for(int dutyCycle = 255; dutyCycle >= 0; dutyCycle--){
    // changing the LED brightness with PWM
    ledcWrite(ledChannel, dutyCycle);   
    delay(15);
  }
}

3. Interrupt

The interrupt of ESP32-S3 can be freely allocated.

3. Serial Port

Mapping is required for initializing ESP32 S3 serial port. Available ports: Serial, Serial1, Serial2

Serial1.begin(9600,SERIAL_8N1,/*rx =*/0,/*Tx =*/1);  

4. Servo

ESP32-S3 doesn't support driving servo through the Servo library. Please search and install the ESP32_ISR_Servo library in Sketch->Include Library->Manage Library to drive servo.

5. SD Library

SD Class

File Class

The file class provides the function of reading/writing files. The function of this class is very similar to that of the serial port related functions used before. The member functions are as follows.

Please refer to File-Examples-SD-SD Test.

FAQ

1. What will cause burning error?

How to solve

2. Data cannot be printed on serial port

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents