A gesture project based on X_NUCLRO_53L1A1
Dependencies: Test_SSD1306 mbed X_NUCLEO_53L1A1
main.cpp
- Committer:
- nanecho
- Date:
- 23 months ago
- Revision:
- 0:5ea7efe9f6c9
File content as of revision 0:5ea7efe9f6c9:
#include <stdint.h>
#include <stdio.h>
#include "mbed.h"
#include "XNucleo53L1A1.h"
#include "VL53L1X_I2C.h"
uint16_t distance_centre = 0;
uint16_t distance_left = 0;
int16_t distance_right = 0;
uint8_t state =0;
uint8_t command = 0;
int wait_fun();
void speed(void)
{
if (command == 1 ) {
printf("go forward, speed = %d\r\n",distance_centre - 80);
} else if (command == 2) {
printf("go back, speed = %d\r\n",50 - distance_centre);
} else if (command == 3) {
printf("Waiting, speed = 0\r\n");
} else if (command == 7) {
printf("turn right\r\n");
} else if (command == 8) {
printf("turn left\r\n");
} else if (command ==5) {
printf("left forward, speed = %d\r\n",distance_centre - 80);
} else if (command ==55) {
printf("left backward, speed = %d\r\n",50 - distance_centre);
} else if (command == 6) {
printf ("right forward, speed = %d\r\n",distance_centre - 80);
} else if (command == 66) {
printf ("right backward, speed = %d\r\n",50 - distance_centre);
} else if (command == 4) {
printf("Stop\r\n");
}
}
void main()
{
speed();
}