The example program for mbed pin-compatible platforms
Fork of mbed_blinky by
main.cpp
- Committer:
- vartan
- Date:
- 2014-08-24
- Revision:
- 8:ec3e22e9100e
- Parent:
- 7:b1e0b6f381ba
- Child:
- 9:9088b8a51286
File content as of revision 8:ec3e22e9100e:
#include "mbed.h" #include "MorseCharacter.h" //#include <string> DigitalOut morseOut(LED1); int main() { char* output = "HELLO WORLD"; char strlen = 11; char strpos = 0; float timeUnit = 0.092f; while(strpos < strlen) { MorseCharacter morseChar(output[strpos]); char size = morseChar.getNumberOfParts(); if(size>0) { for(int i=0;i<size;i++) { morseOut = 1; wait((morseChar.getPart(i)==morseChar.DIT?1:3) * timeUnit); morseOut = 0; wait(1*timeUnit); // time between dits/dahs is 1 time unit. } wait(timeUnit*2); // time between letters is 3 time units. // there should already be 1 time unit after the // last dit/dah. } else { wait(timeUnit * 4); // time between words is 7 time units. // there should be 3 time units after the last // character was sent. } strpos++; //strpos = (strpos + 1) % strlen; } while(1) {} }