Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 107:5674ae43e215, committed 2019-12-09
- Comitter:
- luisquiroga
- Date:
- Mon Dec 09 12:09:29 2019 +0000
- Parent:
- 106:d323dd088ba2
- Commit message:
- Este es el que funciona, de momento.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Nov 22 16:00:04 2019 +0000 +++ b/main.cpp Mon Dec 09 12:09:29 2019 +0000 @@ -3,21 +3,26 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "mbed.h" -#include "platform/mbed_thread.h" +#include<mbed.h> -// Blinking rate in milliseconds -#define BLINKING_RATE_MS 500 +AnalogIn signal(GPIO0); +Serial pc(USBTX, USBRX); int main() { - // Initialise the digital pin LED1 as an output - DigitalOut led(LED1); - + //Declaro las variables + float Tension = 0; + unsigned short adcValor; + pc.baud(9600); //Baudrate + while (true) { - led = !led; - thread_sleep_for(BLINKING_RATE_MS); + + adcValor = signal.read_u16(); + float flotante = signal.read(); + //Tension = (adcValor * 3.3/255); // Lo paso a valor de tension + + pc.printf("El valor del ADC %i y leido directo %.2f \r\n", adcValor, flotante); // Imprimo en terminal } }