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.
Fork of frdm_gpio by
main.cpp
- Committer:
- cheperuiz
- Date:
- 2015-07-20
- Revision:
- 10:163208bd16a8
- Parent:
- 9:32e85f1fcd15
File content as of revision 10:163208bd16a8:
#include "mbed.h"
#define ON 0
#define OFF 1
#define ID '0'
DigitalIn magic(PTB0);
DigitalOut redLED(LED_RED);
DigitalOut greenLED(LED_GREEN);
DigitalOut blueLED(LED_BLUE);
Serial pc(USBTX,USBRX);
int main()
{
unsigned char last = magic,t=0;
while(true)
{
if(last != magic)
{
last = magic;
printf("%d",(int)magic);
// wait(0.02);
}
if(pc.readable())
{
t=pc.getc();
switch(t)
{
case '0': //IDLE
redLED = ON;
greenLED = OFF;
blueLED = OFF;
break;
case '1': //PLAY
redLED = OFF;
greenLED = ON;
blueLED = OFF;
break;
case '2': //STOP
redLED = OFF;
greenLED = OFF;
blueLED = ON;
break;
case '3': //REC
redLED = ON;
greenLED = ON;
blueLED = OFF;
break;
case '?':
pc.putc(ID);
break;
default:
redLED = OFF;
greenLED = OFF;
blueLED = OFF;
break;
}
}
wait(0.02);
}
}
