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: HIDScope MODSERIAL QEI TextLCD mbed
Diff: Kalibratie.cpp
- Revision:
- 17:cfe44346645c
- Parent:
- 16:8f175d2a472f
- Child:
- 18:eec0880fcded
--- a/Kalibratie.cpp Fri Oct 09 09:57:09 2015 +0000
+++ b/Kalibratie.cpp Fri Oct 09 11:27:58 2015 +0000
@@ -1,4 +1,61 @@
#include "Kalibratie.h"
+#include "Filterdesigns.h"
+
+Timer Timermax;
+Timer Timermin;
+AnalogIn emg2(A0); //Analog input van emg kabels
+
+DigitalOut LedGreen(LED2);
+DigitalOut LedRed(LED1);
+
+void Init()
+{
+ LedGreen = 1;
+ LedRed = 1;
+}
+
+double KalibratieMax(bool &readymax) //Kalibratie van de maximum waarde
+{
+ Timermax.start(); //Start de timer
+
+ LedGreen.write(0); //Led aan
+ double ymax = 0;
-void Kalibratie(){
-
\ No newline at end of file
+ while(Timermax <= 5) { //Als timer onder de 5 seconden is dit uitvoeren
+ double u = emg2.read();
+ double y = Filterdesigns(u);
+ if (y > ymax) { //Als de gemeten waarde groter is dan de opgeslagen waarde wordt dit de nieuwe opgeslagen waarde
+ ymax = y;
+ }
+ else {
+ }
+ }
+ Timermax.stop();
+ LedGreen.write(1); //Led aan
+ readymax = 1; // Zodat systeem weet wanneer kalibratie voltooid is
+ return ymax;
+}
+
+double KalibratieMin(bool &readymin) //Kalibratie van de minimum waarde
+{
+ Timermin.start();
+
+ LedRed.write(0);
+ double ymin = 10;
+
+ while(Timermin <= 5) {
+ double u = emg2.read();
+ double y = Filterdesigns(u);
+
+ if (y < ymin) {
+ ymin = y;
+ }
+ else {
+ }
+ }
+
+ Timermin.stop();
+ LedRed.write(1);
+ readymin = 1;
+ return ymin;
+}
\ No newline at end of file