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: biquadFilter mbed MODSERIAL
Diff: main.cpp
- Revision:
- 8:8e7c928aadc6
- Parent:
- 7:9af8fe930b3c
- Child:
- 10:a8a07e4ce85c
--- a/main.cpp Thu Nov 02 17:42:08 2017 +0000
+++ b/main.cpp Thu Nov 02 18:40:12 2017 +0000
@@ -532,12 +532,10 @@
}
// Function which makes it possible to lower the end-effector to pick up a piece
-void zakker(){
- if(Move_done==true){ //misschien moet je hier als voorwaarden een delta is 1 zetten // hierdoor wacht dit programma totdat de beweging klaar is
-
- dLod=sqrt(pow(Lou,2)+pow(287.85,2))-Lou; //dit is wat je motoren moeten doen om te zakken
- dLbd=sqrt(pow(Lbu,2)+pow(277.85,2))-Lbu; // dat laatste getal moet nog aangepast worden
- dLrd=sqrt(pow(Lru,2)+pow(277.85,2))-Lru;
+void zakker(){ // hierdoor wacht dit programma totdat de beweging klaar is
+ dLod=sqrt(pow(Lou,2)+pow((277.85),2))-Lou; //dit is wat je motoren moeten doen om te zakken
+ dLbd=sqrt(pow(Lbu,2)+pow((277.85),2))-Lbu; // dat laatste getal moet nog aangepast worden
+ dLrd=sqrt(pow(Lru,2)+pow((277.85),2))-Lru;
rotzo=dLod/omtrekklosje;
rotzb=dLbd/omtrekklosje;
rotzr=dLrd/omtrekklosje;
@@ -553,7 +551,7 @@
pc.printf("o=%.2f b=%.2f countzr=%.2f",countzo,countzb,countzr); // hier moet komen te staan hoe het zakken gaat
pc.printf("Position_r = %i;reference_r=%i Error_r=%i\n\r" ,position_o,reference_o,error_o);
}
-}
+
void tiller(){
int reference_o = hcounto-12487;
@@ -566,7 +564,14 @@
controlmotor2.attach(&MotorController2, 0.01);
controlmotor3.attach(&MotorController3, 0.01);
}
-
+
+void zakken_threshold() {
+ if (Move_done == true) {
+ if (emgBLcomplete > thresholdBL) {
+ zakker();
+ }
+ }
+ }
void setcurrentposition(){
if(Input_done==true){
@@ -589,7 +594,8 @@
setcurrentposition();
while(true){
sample_timer.attach(&EMG_sample, 0.002);
- button2.fall(zakker);
+ //button2.fall(zakker);
+ zakken_threshold();
wait(2.5f);
tellerX();
tellerY();