Menu
Microbots
0
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • Modules & Parts
    • Tools & Gears
    • Robots & Displays
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Sign in
  • English
  • Your Cart is Empty
Microbots
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • Modules & Parts
    • Tools & Gears
    • Robots & Displays
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Language

  • 0 0

CodeCell: Read Analog Values with ADC

Analog sensors, potentiometers, and other variable inputs require an Analog-to-Digital Converter (ADC) to be read by a microcontroller. With CodeCell, reading an analog signal is as simple as calling pinADC().

How to Use pinADC()

To read an analog value, use:

uint16_t myADC = myCodeCell.pinADC(uint8_t pin_num);
  • pin_num → The ADC pin you want to read from (IO1, IO2, or IO3).
  • Returns a 12-bit value between 0 and 4095 (corresponding to 0V – 2.5V, due to the internal voltage reference).

Example: Reading a Potentiometer

If you connect a potentiometer to IO2, you can read its position with:

uint16_t potValue = myCodeCell.pinADC(2);
Serial.println(potValue);

Correct Potentiometer Wiring:

Since the maximum voltage on CodeCell’s ADC pins should not exceed 3.3V, you should connect the potentiometer to 3V3 instead of Vo:

3V3 → One end of the potentiometer  
GND → Other end of the potentiometer  
IO2 → Middle pin of the potentiometer  

Important: Internal Voltage Reference is 2.5V

The onboard microcontroller uses a 2.5V internal voltage reference. This means:

  • If your input voltage is 2.5V, the ADC reading will be 4095 (max value) - any voltage above 2.5V will be 4095
  • If your input voltage is 1.25V, the ADC reading will be around 2048.

To scale readings properly:

float voltage = (myCodeCell.pinADC(2) / 4095.0) * 2.5;
Serial.println(voltage);

 

Whether you're reading a potentiometer,  sensor, or other analog signals, CodeCell makes ADC reading easy. 

  • Share:

Follow

Github

  • About
  • Software
  • Education
  • Contact
  • FAQs
  • Terms
  • Refund Policy
  • Privacy Policy

Join our Community ~ Be the first to know about new products and get exciting deals!

© 2026 Microbots.

★ Reviews

Let customers speak for us

41 reviews
Write a review
80%
(33)
5%
(2)
2%
(1)
5%
(2)
7%
(3)
21
37
A
CodeCell C6
Anonymous

Love it

L
CoilCell
Laszlo Hasenau

Nice to have the drivers integrated, sufficient for very small units, where low force needed.

User picture
L
CodeCell C6 Drive
Leon

Love this thing! The coding for controlling the integrated drivers is extremely intuitive, the chip is fast as always and all the other sensors work like a charm. If there were 6 stars id give all of em but theres only 5 XD

A
CodeCell C6 Drive
Anonymous

Pequeno e esperto. TEM projetos com câmera 📷🎥?
DVR PARA MOTO 🛵?

A
CodeCell C3
Anonymous

Busy developing something that has been a very popular topic in the maker space. Once complete I will share it all with you including the coding.I am really impressed with the punch this little C3 packs. Really a great piece of engineering. Keep up the brilliant work and thank you for making this little giant!!!!!!

123