Skip to content

Commit c608286

Browse files
committed
XDU_Contactless-distribution-robot
1 parent 85aa122 commit c608286

File tree

2 files changed

+39
-76
lines changed

2 files changed

+39
-76
lines changed

arc_design_contest/2020/XDU_Contactless-distribution-robot/src/dw_uart_obj.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@
5555
#include "arc_builtin.h"
5656
#include "embARC_toolchain.h"
5757
#include "embARC_error.h"
58-
5958
#include "arc_exception.h"
60-
6159
#include "dw_uart.h"
6260
#include "dw_uart_obj.h"
6361

arc_design_contest/2020/XDU_Contactless-distribution-robot/src/main.c

Lines changed: 39 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,20 @@
1414
#include "syn6288.h"
1515
#include "chinfo.h"
1616

17-
1817
#define uchar unsigned char
1918
#define uint unsigned int
2019
uint8_t *a;
2120
uint8_t q;//body detect sign
2221
uint8_t b;
2322

24-
25-
2623
uint8_t *phone; //telephone number
2724
uint8_t *verify;//verify password
28-
uint8_t *password;//input password
29-
30-
25+
uint8_t *password;//input password
3126

3227
int main(void)
33-
{
34-
28+
{
3529
cpu_lock(); /* lock cpu to do initializations */
36-
3730
board_init(); /* board level init */
38-
3931
cpu_unlock(); /* unlock cpu to let inetrrupt work */
4032

4133
EMBARC_PRINTF("init...\r\n");
@@ -50,129 +42,102 @@ int main(void)
5042

5143
while(1)
5244
{
53-
5445
EMBARC_PRINTF("TONIGHT!!!\r\n");
55-
5646
//body detect---------------------------------------------
57-
58-
while(!(q==1))
59-
{
47+
while(!(q==1)){
6048
q=HC_SR501_Status();
6149
board_delay_ms(500,1);
62-
};
50+
};
6351
board_delay_ms(500,1);
6452
EMBARC_PRINTF("Welcome...\r\n");
6553
SYN6288_info(INFO_1);
6654
board_delay_ms(7000,1);
67-
68-
//key out-------------------------------------------------s
69-
55+
//key out-------------------------------------------------
7056
PWM1_0();
71-
7257
//input telephone number----------------------------------
73-
7458
while(!(keypad_read()==12));
75-
7659
SYN6288_info(INFO_2);
7760
board_delay_ms(5000,1);
7861
EMBARC_PRINTF("Please input telephone number...\r\n");
79-
phone = VerifyString(11);
62+
phone = VerifyString(11);
8063
//EMBARC_PRINTF("tele:%s\r\n",phone);
8164
while(!(keypad_read ()==13));//input Enter
8265
EMBARC_PRINTF("Successful!\r\n");
8366
SYN6288_info(INFO_3);
8467
board_delay_ms(2500,1);
85-
8668
//input target--------------------------------------------
87-
88-
EMBARC_PRINTF("Please input target...\r\n");
69+
EMBARC_PRINTF("Please input target...\r\n");
8970
SYN6288_info(INFO_4);
9071
board_delay_ms(3000,1);
9172
a=(uint8_t *)malloc(4);
92-
a = VerifyString(1);
73+
a = VerifyString(1);
9374
b=a[3]-48;
94-
//EMBARC_PRINTF("%s\r\n",a);
75+
//EMBARC_PRINTF("%s\r\n",a);
9576
EMBARC_PRINTF("%d\r\n",b);
96-
while(!(keypad_read ()==13));
77+
while(!(keypad_read ()==13));
9778
EMBARC_PRINTF("Successful!\r\n");
9879
SYN6288_info(INFO_3);
9980
board_delay_ms(2500,1);
100-
10181
//open box-----------------------------------------------
102-
103-
EMBARC_PRINTF("Finish set! Please input thing...\r\n");
82+
EMBARC_PRINTF("Finish set! Please input thing...\r\n");
10483
SYN6288_info(INFO_5);
10584
board_delay_ms(5500,1);
106-
PWM2_0();
107-
while(!(keypad_read ()==13));
108-
PWM2_120();
109-
85+
PWM2_0();
86+
while(!(keypad_read ()==13));
87+
PWM2_120();
11088
//move ---------------------------------------------------
111-
11289
board_delay_ms(1000,1);
11390
EMBARC_PRINTF("Start move...\r\n");
114-
SYN6288_info(INFO_6);
91+
SYN6288_info(INFO_6);
11592
board_delay_ms(3000,1);
11693
PWM1_90();
11794
board_delay_ms(1000,1);
11895
car_control(b);//choose route
119-
12096
//send message and call-----------------------------------
121-
122-
verify=(uint8_t *)malloc(16);
97+
verify=(uint8_t *)malloc(16);
12398
verify = send(phone);
124-
EMBARC_PRINTF("send successfuly\r\n");
99+
EMBARC_PRINTF("send successfuly\r\n");
125100
SYN6288_info(INFO_8);
126101
board_delay_ms(5000,1);
127102
call(phone);
128-
129-
130-
131103
//body detect---------------------------------------------
132-
133-
board_delay_ms(5000,1);
134-
while(!(q==1))
135-
{
104+
board_delay_ms(5000,1);
105+
while(!(q==1)){
136106
q=HC_SR501_Status();
137107
board_delay_ms(500,1);
138-
};
108+
};
139109
//input password------------------------------------------
140-
141110
PWM1_0();
142111
while(1){
143112
EMBARC_PRINTF("Please input password...\r\n");
144-
SYN6288_info(INFO_9);
113+
SYN6288_info(INFO_9);
145114
board_delay_ms(5000,1);
146-
password=(uint8_t *)malloc(16);
115+
password=(uint8_t *)malloc(16);
147116
password = VerifyString(4);
148-
//EMBARC_PRINTF("%s\r\n",password);
149-
while(!(keypad_read ()==13));
150-
board_delay_ms(1000,1);
151-
if(password[3]==verify[3]&&password[7]==verify[7]&&password[11]==verify[11]&&password[15]==verify[15])
152-
{
153-
SYN6288_info(INFO_10);
154-
board_delay_ms(3000,1);
155-
PWM2_0();
156-
break;
157-
}
158-
else
159-
{
160-
board_delay_ms(1000,1);
161-
EMBARC_PRINTF("\r\n");
162-
SYN6288_info(INFO_11);
163-
board_delay_ms(4000,1);
117+
//EMBARC_PRINTF("%s\r\n",password);
118+
while(!(keypad_read ()==13));
119+
board_delay_ms(1000,1);
120+
if(password[3]==verify[3]&&password[7]==verify[7]&&password[11]==verify[11]&&password[15]==verify[15]){
121+
SYN6288_info(INFO_10);
122+
board_delay_ms(3000,1);
123+
PWM2_0();
124+
break;
125+
}
126+
else{
127+
board_delay_ms(1000,1);
128+
EMBARC_PRINTF("\r\n");
129+
SYN6288_info(INFO_11);
130+
board_delay_ms(4000,1);
164131
}
165-
}
166-
132+
}
167133
//finish one task-----------------------------------------
168-
169134
while(!(keypad_read ()==13));
170-
PWM2_120();
135+
PWM2_120();
171136
board_delay_ms(2000,1);
172137
EMBARC_PRINTF("Finish!!!\r\n");
173138
SYN6288_info(INFO_12);
174139
board_delay_ms(5000,0);
175-
PWM1_90();
140+
PWM1_90();
176141
board_delay_ms(5000,1);
177142
}
178143
return E_SYS; /* system error */

0 commit comments

Comments
 (0)