https://toitlang.org/ logo
If you are using an ESP32S3, then pin 22 doesn't e...
# general
f
If you are using an ESP32S3, then pin 22 doesn't exist for you. That also explains the "ALREADY_IN_USE". If a pin is not available this error is thrown. If you look at the documentation of the GPIO library you can see that the ESP32S3 doesn't expose any pin 22: https://libs.toit.io/gpio/library-summary Assuming you have the DevKitC-1 you can use the following pinout:

https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/_images/ESP32-S3_DevKitC-1_pinlayout_v1.1.jpg▾

It shows that that the U0TXD and U0RXD are on pin 43/44. These are routed to the UART-USB converter (the UART/COM USB port). The USB port (marked "USB") is connected to GPIO20/19. The ESP32S3 needs to implement USB to make use of that port. As I wrote above, you can maybe change the sdkconfig to use the USB for the console output (the CDC option), in which case pins 43/44 would become free and could be used as normal uart. You could also change the console output to different pins (like GPIO10/11) and then use 43/44 for your program. It would then be up to you to get the output of GPIO10/11 to your computer. For example with an external UART-USB converter. Please ask questions in the #help forum. Please use triple-backticks for code, so that it is correctly formatted.
Copy code
`​`​`
your code
`​`​`