I'll change my board from arduino to ESP32. What should I do with my code, considering that Arduino uses a 10 bit ADC and ESP32 uses a 12 bit ADC?
Welcome to the forum
We don't know what your code should do or how you have programmed it. Please post your code, using code tags when you do
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
Use ratio.
10 bit max = 1024
12 bit max = 4096
Ratio of 4096 to 1024 is 4.
(10 bit relative value) * 4 = (12 bit relative value)
Example: 10 bit 512. 1024/512 = 2.
10 bit (512 * 4) = 12 bit (2048)... 4096/2048 = 2.
You can also shift right 2 or divide by 4. When you change processors things do change because of the processor hardware and its dependencies. You also may not have the same amount analog ports and there max voltage and impedance may also differ. Your on chip peripherals will be different (hardware dependent). Most of your non hardware code should work just fine. Remember you cannot adjust something that is not there. Your external peripherals may have to change because of hardware dependencies (voltage mainly).
Set the IDE for the correct board and compile it will give you errors which are due manly to the different hardware. Bear with it and it will become second nature.
Also the ESP32 ADC is non linear at the ends and needs to be calibrated.