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: mbed FastPWM HIDScope MODSERIAL QEI
Revision 2:bf1466ac4e6f, committed 2016-10-13
- Comitter:
- TimDouma
- Date:
- Thu Oct 13 12:34:30 2016 +0000
- Parent:
- 1:709a462b8373
- Child:
- 3:ac6f86c0db6e
- Commit message:
- linker en rechter D waarde gesplitst, ticker werkt alleen nog met een void functie;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 12 14:39:29 2016 +0000
+++ b/main.cpp Thu Oct 13 12:34:30 2016 +0000
@@ -16,20 +16,32 @@
// functie om D1 en D2 te berekenen
-float AfstandBerekenen ()
+float AfstandBerekenenLinks ()
{
float BV1 = sqrt(pow((a+x),2) + pow(y,2)); // diagonaal (afstand van armas tot locatie) berekenen
- float BV2 = sqrt(pow((x-a),2) + pow(y,2));
-
float D1 = pow(BV1,2)/(2*BV1); // berekenen van de afstand oorsprong tot diagonaal
- float D2 = pow(BV2,2)/(2*BV2);
-
pc.baud(SERIAL_BAUD);
- pc.printf("\r\n D1 = %f en D2 = %f\r\n", D1, D2);
+ pc.printf("D1 = %f\r\n", D1);
return D1 ;
}
+float AfstandBerekenenRechts()
+{
+ float BV2 = sqrt(pow((x-a),2) + pow(y,2));// diagonaal (afstand van armas tot locatie) berekenen
+ float D2 = pow(BV2,2)/(2*BV2); // berekenen van de afstand oorsprong tot diagonaal
+ pc.baud(SERIAL_BAUD);
+ pc.printf("D2 = %f\r\n", D2);
+
+ return D2 ;
+}
+void Blij()
+{
+ pc.baud(SERIAL_BAUD);
+ pc.printf("het werkt wel met een void functie\r\n");
+}
+
+
/*
void MotorhoekBerekenen (){
if (x > -a){
@@ -37,13 +49,14 @@
*/
int main()
{
+ float D1 = AfstandBerekenenLinks();
+ float D2 = AfstandBerekenenRechts();
+
+ TickerAfstandBerekenen.attach(&AfstandBerekenenLinks,1);
- //TickerAfstandBerekenen.attach(&AfstandBerekenen, 0.1);
- float D1 = AfstandBerekenen();
- //float D2 = AfstandBerekenen(x,y);
pc.baud(SERIAL_BAUD);
- pc.printf("D1 = %f\r\n", D1);
- //AfstandBerekenen();
+ pc.printf("D1 = %f en D2 = %f\r\n", D1, D2);
+
while (true) {
}