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: SDFileSystem mbed
Fork of PES4_Programme by
Diff: source/main.cpp
- Revision:
- 92:96ad0a9ff337
- Parent:
- 91:443b0ac21de0
- Child:
- 94:b24d2b432b27
--- a/source/main.cpp Tue Apr 10 06:58:41 2018 +0000
+++ b/source/main.cpp Tue Apr 10 07:39:48 2018 +0000
@@ -7,7 +7,6 @@
int oldState;
/* Input / Output */
-Serial pc(USBTX, USBRX);
DigitalIn lichtschranke(PC_5);
InterruptIn userButton1(PB_5);
InterruptIn userButton2(PB_4);
@@ -56,11 +55,6 @@
{
/* SD write Test*/
- medicationTime = getTime();
-
- outputTime = getTime();
- currentTime = getTime();
-
medication.container[0] = 1;
medication.container[1] = 2;
medication.container[2] = 2;
@@ -78,7 +72,7 @@
*/
/************/
- pc.baud(460800);
+ setBaud();
printf("start...\r\n");
while(1) {
@@ -91,19 +85,8 @@
printf("Hello World");
state = 47;
break;
-
+
case 1:
- char command;
- if(pc.readable()) {
- command = pc.getc();
- } else if(command == 'w') {
- if(pc.writeable()) {
- printf("%s", send);
- }
- } else {
- state = 47;
- }
-
break;
case 2:
@@ -231,11 +214,12 @@
printf("61\twrite_medInventory\n\r");
printf("62\twrite_medError\n\r");
printf("63\terase_errorPotocol\n\r");
- printf("64\t \n\r");
- printf("65\t \n\r");
- printf("66\t \n\r");
- printf("67\t \n\r");
- pc.scanf("%d", &state);
+ printf("64\terase_medPotocol\n\r");
+ printf("65\tread_medPotocol\n\r");
+ printf("66\tread_medInventory\n\r");
+ printf("67\tread_medError\n\r");
+ printf("68\tread_Inventory\n\r");
+ scanf("%d", &state);
printf("Switch to State %d\n\r",state);
fflush(stdin);
break;
@@ -247,9 +231,9 @@
channel = 0;
while (channel < 16) {
printf("Channel Number: ");
- pc.scanf("%d", &channel);
+ scanf("%d", &channel);
printf("\r\nchannel: %d\n\rDuty Cycle 0..4095: ",channel);
- pc.scanf("%d", &dutyCycle);
+ scanf("%d", &dutyCycle);
printf("\n\r%d\n\r",dutyCycle);
setPWM((char)channel, (int)dutyCycle);
fflush(stdin);
@@ -296,10 +280,10 @@
day = 0;
while (day < 7) {
printf("\r\nDay Number: ");
- pc.scanf("%d", &day);
+ scanf("%d", &day);
if(day < 7) {
printf("\r\nDay: %d\n\rMoment 0..3: ",day);
- pc.scanf("%d", &moment);
+ scanf("%d", &moment);
printf("\r\nMedication for weekday %d Moment %d is ",day,moment);
for(int i=0; i<6; i++) {
printf("%d", prescription[1].medication.day[day].moment[moment].medContainer.container[i]);
@@ -387,6 +371,8 @@
break;
case 60:
+ outputTime = getTime();
+ medicationTime = getTime();
printf("write_medProtocol\n\r");
write_medProtocol(medicationTime, outputTime, medication, success, user);
printf("done\n\r");
