add all sensors used

Dependencies:   mbed QEI-1 nRF24L01P xiugai

Revision:
7:dc221ddd4588
Parent:
6:7db9b13ece76
--- a/main.cpp	Sun Nov 03 08:26:46 2019 +0000
+++ b/main.cpp	Tue Dec 01 01:38:26 2020 +0000
@@ -4,82 +4,17 @@
 #include <string>
 typedef bool boolean;
 typedef std::string String;
-#include "QEI.h"
-#include "converters.h"
 
-int Position;
-float Error;
-int Output;
-float Error_Last;
-float P;
-float Error_int;
-float I;
-float Error_diff;
-float D;
-
-QEI qei_PA_0(PA_0,PA_1,NC,13,QEI::X4_ENCODING);
-Serial Serial_2(PA_2,PA_3);
-PwmOut myServoPB_0(PB_0);
-PwmOut myServoPB_1(PB_1);
-Ticker tick241376;
-
-void PID_Caculation() {
-Error = 0 - Position;
-Error_diff = Error - Error_Last;
-Error_Last = Error;
-Error_int = Error_int + Error;
-if (Error_int > 100) {
-Error_int = 100;
-} else if (Error_int < -100) {
-Error_int = -100;
-}
-if (Error > -10 && Error < 10) {
-Output = 0;
-} else {
-Output = P * Error + (I * Error_int + D * Error_diff);
-}
-if (Output > 100) {
-Output = 100;
-} else if (Output < -100) {
-Output = -100;
-}
-}
-
-void Set_speed() {
-if (Output >= 0) {
-myServoPB_0.period_ms(20);
-myServoPB_0.pulsewidth_us((200 * Output));
-myServoPB_1.period_ms(20);
-myServoPB_1.pulsewidth_us(0);
-} else if (Output < 0) {
-myServoPB_0.period_ms(20);
-myServoPB_0.pulsewidth_us(0);
-myServoPB_1.period_ms(20);
-myServoPB_1.pulsewidth_us((-200 * Output));
-}
-}
-
-void tick241376_handle() {
-Position = Position + qei_PA_0.getPulses();
-qei_PA_0.reset();
-Serial_2.printf("%d\n",_p(Position));
-PID_Caculation();
-Set_speed();
-}
-
+DigitalOut myDigitalOutPA_0(PC_13);
 
 int main() {
 
 
-Serial_2.baud(9600);
-
-tick241376.attach(&tick241376_handle,0.05);
-Position = 0;
-qei_PA_0.reset();
-P = 1;
-I = 0;
-D = 1;
 while (true) {
+myDigitalOutPA_0.write(HIGH);
+wait_ms(1000);
+//myDigitalOutPA//_0.write(LOW);
+//wait_ms(1000);
 }
 
 }
\ No newline at end of file