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
Diff: Doodler/Doodler.cpp
- Revision:
- 13:10851784af9a
- Parent:
- 12:c5123abb4fbe
- Child:
- 14:529f798adae4
--- a/Doodler/Doodler.cpp Wed Apr 17 17:53:27 2019 +0000 +++ b/Doodler/Doodler.cpp Thu Apr 18 14:54:51 2019 +0000 @@ -18,10 +18,9 @@ lcd.drawCircle(_pos_x, _pos_y, _radius, FILL_BLACK); } -void Doodler::update(Direction d, float mag, float current_vel_x, double current_vel_y){ +void Doodler::update(Direction d, float mag){ //////////////////////////// y - direction of doodler ///////////////////////////////////// - _velocity_x = current_vel_x; - _velocity_y = (double)current_vel_y; + _velocity_y = (double)get_velocity_y(); if ((double)_velocity_y >= 0.00){ // no jump _pos_y += _velocity_y; @@ -30,7 +29,7 @@ _velocity_y = -((double)_velocity_y * (double)_up); // jumps decelerating upwards (0<_up<1 so _velocity.y reaches 0) _pos_y += _velocity_y*5; - if (fabs((double)_velocity_y) < 0.005){ // decelerated completely + if (fabs((double)_velocity_y) < 0.008){ // decelerated completely _velocity_y = _gravity; } }