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

57 reviews
Write a review
84%
(48)
5%
(3)
2%
(1)
4%
(2)
5%
(3)
53
21
A
MotorCell
Anonymous

Integrated Driver in such small size, unbeatable.

A
ProtoBot N20 Motors
Anonymous

Powerful geared brushed Motors.

A
DriveCell
Anonymous

Great products.

G
CodeCell C6 Drive
Gerhard Weidenauer

Great board with many funktions in small space

User picture
L
MotorCell
Lennart Lange

Nice packaging, good follow up on the delivery, need to look up some online resources now for my first actual project wiht the cell

123