added code for PCB on and off, added pointers to e_button and pwm pins
Dependencies: QEI2 chair_BNO055 PID VL53L1X_Filter
Dependents: wheelchairControlSumer2019
Diff: wheelchair.cpp
- Revision:
- 27:0b1a837f123c
- Parent:
- 26:662693bd7f31
- Child:
- 28:ad02cb329fe3
--- a/wheelchair.cpp Thu Jun 27 16:32:12 2019 +0000 +++ b/wheelchair.cpp Thu Jun 27 18:08:29 2019 +0000 @@ -12,6 +12,8 @@ double dist_old, curr_pos; // Variables for odometry position +DigitalOut signal(D5); // Output to send "STOP" signal to wheelchair +DigitalIn button(D4, PullDown); // Emergency Stop button PID myPID(&pid_yaw, &Output, &Setpoint, 5.5, .00, 0.0036, P_ON_E, DIRECT); // Angle PID object constructor PID myPIDDistance(&Input, &Output, &Setpoint, 5.5, .00, 0.002, P_ON_E, DIRECT); // Distance PID object constructor @@ -35,6 +37,25 @@ curr_pos = wheel->getDistance(53.975); } +void Wheelchair::emergencyButton_thread () { + while(1) { + signal = 0; + while(!button) { + + //Send something to stop wheelchair + signal = 1; + + printf("Hello there!\n"); + printf("I'm dead\n\n\n"); + + //Reset Board + NVIC_SystemReset(); + + } + + } +} + void Wheelchair::assistSafe_thread() { int ToFV[12];