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
Diff: main.cpp
- Revision:
- 0:e6c5f77b1cae
diff -r 000000000000 -r e6c5f77b1cae main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Nov 17 03:08:56 2015 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+
+Serial bluetooth(D8,D2);
+
+AnalogIn VR(A0);
+BusOut main_unit(D3,D4,D5,D6);
+BusOut tens(D7,D9,D10,D11);
+
+
+int main()
+{
+ int num_in,num_mem;
+ uint8_t menu;
+ while(1) {
+ bluetooth.printf("Main Menu\npush 1 to Play with number.\npush 2 to Read voltage from VR\n\n");
+ menu = bluetooth.getc();
+ switch(menu) {
+ case '1':
+ num_in=0;
+ num_mem=0;
+ bluetooth.printf("Please insert number from 0 to 99\n");
+ bluetooth.scanf("%d/0" ,&num_in);
+ num_mem=num_in%10;
+ main_unit=num_mem;
+ tens=(num_in-num_mem)/10;
+ bluetooth.printf("Your number is %d\n\n",num_in);
+ break;
+ case '2':
+ bluetooth.printf("Your voltage is %f\n\n", VR.read()*5);
+ break;
+ }
+ }
+}
\ No newline at end of file