Prerequisites
- During the installation of Tina, the ESP32 compiler package must have been installed earlier.
- Analysis/Options/Digital Simulation/Advanced: Arduino path must be set.
Creating a New Example and Compiling Arduino Code on the ESP32C3 Microcontroller
Locate the Logic_ICs-MCUs tab on the toolbar and press the Arduino button. From here, select the ESP32C3 microcontroller and place it on the schematic.

Right-click on the MCU and select Open MCU code editor…

In the code editor, press the Add Existing file to Project button. This allows you to add a previously saved Arduino program to the project.

The Arduino program:
const int buttonPin = 2; // Pin connected to the button
const int ledPin = 3; // Pin connected to the LED (or output device)
int buttonState = 0; // Variable to store the button’s state
void setup() {
pinMode(buttonPin, INPUT); // Set the button pin as an input
pinMode(ledPin, OUTPUT); // Set the LED pin as an output
}
void loop() {
buttonState = digitalRead(buttonPin); // Read the button’s state
if (buttonState == HIGH) { // If the button is pressed
digitalWrite(ledPin, HIGH); // Turn the LED on
} else {
digitalWrite(ledPin, LOW); // Turn the LED off
}
delay(10); // Short delay to debounce the button
}
Press the Make Project button on the toolbar to compile the program.

Then press the Save Project button and close the window.
In the circuit editor, you can continue editing the circuit. Add the switch and the LED.

Simulation on the ESP32C3 Microcontroller
Open the example:
Examples/Microcontrollers/ESP32/esp32c3_digitalread.tsc
This example reads the state of a switch from the GPIO input and, depending on its position, turns the L1 LED on or off.

Press the TR button to start the simulation. Toggle the SW-HL1 switch; the L1 LED should turn on and off accordingly.

NOTE:
Debugging on the ESP32 is not supported at the time of writing this manual.