Fork me on GitHub

ADC

This library provides ADC API which allows to read data from the analog input.

C API Reference mgos_adc.h

#include "mgos_adc.h"

See on GitHub: mgos_adc.h, mgos_adc.c


bool mgos_adc_enable(int pin);

Configure and enable ADC

int mgos_adc_read(int pin);

Read from the analog pin

JAVASCRIPT API Reference api_adc.js

load("api_adc.js");


ADC.enable(pin)

Configure and enable ADC for a pin, return 1 if success, 0 otherwise.

ADC.read(pin)

Read pin analog value, return an integer.