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: Encoder HIDScope MODSERIAL- mbed-dsp mbed
Fork of PROJECT_FINAL_VERSLAG by
Diff: PROJECT_main.cpp
- Revision:
- 14:c2389571f8d6
- Parent:
- 12:b09b7fe5550c
- Child:
- 15:031e29cb39e7
diff -r b09b7fe5550c -r c2389571f8d6 PROJECT_main.cpp
--- a/PROJECT_main.cpp Mon Nov 03 22:47:59 2014 +0000
+++ b/PROJECT_main.cpp Mon Nov 03 23:29:06 2014 +0000
@@ -13,7 +13,7 @@
//Define objects
-HIDScope scope(5);
+HIDScope scope(6);
AnalogIn emg0(PTB1); //Analog input biceps
AnalogIn emg1(PTB2); //Analog input triceps
@@ -524,8 +524,6 @@
/* Vanaf hier komt de aansturing van de motor */
-
-// FORMAT_CODE_START
setpoint1=0;
setpoint2=0;
integral1 = integral = 0;
@@ -535,8 +533,6 @@
while(1) { // loop voor het goed plaatsen van motor2 (batje hoek)
while(!looptimerflag);
looptimerflag = false; //clear flag
-
-// FORMAT_CODE_START
scope.set(0, motor2.getPosition()*omrekenfactor2);
scope.set(1, setpoint2);
@@ -629,6 +625,8 @@
integral1 = integral1 + (controlerror1*TSAMP);
derivative1 = (controlerror1 - previouserror1)/TSAMP;
pwm1 = Kp1*controlerror1 + Ki1*integral1 + Kd1*derivative1;
+ pc.printf("%d_%f\n\r",state,pwm1);
+ scope.set(5, pwm1);
previouserror1 = controlerror1;
keep_in_range(&pwm1, -1,1);
