Alejandro M
/
TutoElectro_ADC
Simple ADC tutorial using FRDM-KL25Z made by Twistx77 from TutoElectro
main.cpp
- Committer:
- Twistx77
- Date:
- 2015-01-04
- Revision:
- 0:6c0fee4aea35
File content as of revision 0:6c0fee4aea35:
#include "mbed.h" AnalogIn LDR(A0); Serial pc(USBTX,USBRX); int main() { uint16_t adcValue; float voltage; pc.baud(115200); while(1) { adcValue = LDR.read_u16(); voltage = adcValue *3.3 / 65535; pc.printf("ADC Value: %i, %.3f volts.\r\n", adcValue, voltage); wait(0.1); } }