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.
Dependencies: mbed
Command.h
- Committer:
- uswickra
- Date:
- 2014-08-31
- Revision:
- 2:04d8e2ad8cff
- Parent:
- 0:ece62a42511f
- Child:
- 3:ec4615b81eeb
File content as of revision 2:04d8e2ad8cff:
#pragma once extern Serial pc; extern DigitalOut led1; extern DigitalOut led2; extern DigitalOut led3; extern DigitalOut led4; class Cmd { protected: char* cmd_name; void newline(){ pc.putc(0x0d); pc.putc(0x0a); } public: virtual void execute(int arg_val) { newline(); pc.puts("ERR"); } char* get_name() { return cmd_name; }; }; class Led_On_Cmd: public Cmd { public: Led_On_Cmd() { cmd_name = "LON"; } void execute(int arg_val) { newline(); pc.puts("OK"); if(arg_val == 1) { led1 = 1; } else if (arg_val == 2) { led2 = 1; } else if (arg_val == 3) { led3 = 1; } else if (arg_val == 4) { led4 = 1; } } }; class Led_Off_Cmd: public Cmd { public: Led_Off_Cmd() { cmd_name = "LOF"; } void execute(int arg_val) { newline(); pc.puts("OK"); if(arg_val == 1) { led1 = 0; } else if (arg_val == 2) { led2 = 0; } else if (arg_val == 3) { led3 = 0; } else if (arg_val == 4) { led4 = 0; } } }; class Help_cmd: public Cmd { public: Help_cmd() { cmd_name = "help"; } void execute(int arg_val) { newline(); pc.puts("Usage : "); newline(); pc.puts("EON <led_num> : Turn on led indicated by <led_num>"); newline(); pc.puts("EOF <led_num> : Turn off led indicated by <led_num>"); } };