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:
- 16:e0542761fc8c
- Parent:
- 15:4efa04a6a376
- Child:
- 17:74de8c17ddac
--- a/Doodler/Doodler.cpp Tue Apr 23 23:14:06 2019 +0000 +++ b/Doodler/Doodler.cpp Wed Apr 24 10:33:39 2019 +0000 @@ -29,12 +29,12 @@ lcd.drawCircle(_position_x, _position_y, _radius, FILL_BLACK); } -void Doodler::update(Direction d, float mag){ +void Doodler::update(Direction d, float mag, bool button_Y){ // 5 frames times the magnitude of the joystick (int holds that value) _velocity_x = int(mag*5.0f); - if (d == W){ // if direction is left + if (d == W || d == NW || d == SW){ // if direction is left (at an angle or not) _position_x -= _velocity_x; - } else if (d == E){ + } else if (d == E || d == NE || d == SE){ _position_x += _velocity_x; } // checking doodler does not leave screen: @@ -80,4 +80,5 @@ void Doodler::set_position(float pos_x, float pos_y){ _position_x = pos_x; _position_y = pos_y; -} \ No newline at end of file +} +