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.
Diff: main.cpp
- Revision:
- 0:f426f91e8afe
- Child:
- 1:26d97d40960d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 25 01:34:53 2018 +0000 @@ -0,0 +1,58 @@ +#include "mbed.h" +#include <Timer.h> +Serial command(USBTX, USBRX); +DigitalIn button(USER_BUTTON); +DigitalOut led(LED1); +DigitalIn OUT(PA_2); +DigitalOut S0(PA_5); +DigitalOut S1(PA_3); +DigitalOut S2(PC_4); +DigitalOut S3(PA_4); + +Timer tiempo; + + +int main() +{ + + //int time = 0; + int Red = 0; + int Blue = 0; + int Green = 0; + + while(1){ + S0 = 1; + S1 = 1; + //Leer Rojo + S2 = 0; + S3 = 0; + while(OUT){} + tiempo.start(); + while(!OUT){} + tiempo.stop(); + Red = tiempo.read_ms(); + printf("Red: %d, ",Red); + tiempo.reset(); + //Leer Azul + S2 = 0; + S3 = 1; + while(OUT){} + tiempo.start(); + while(!OUT){} + tiempo.stop(); + Blue = tiempo.read_ms(); + printf("Blue: %d, ",Blue); + tiempo.reset(); + //Leer Verde + S2 = 1; + S3 = 1; + while(OUT){} + tiempo.start(); + while(!OUT){} + tiempo.stop(); + Green = tiempo.read_ms(); + printf("Green: %d\n",Green); + tiempo.reset(); + } +} +