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: Spikes/Spikes.cpp
- Revision:
- 17:18ae81180853
- Parent:
- 13:cfdfe60a2327
- Child:
- 18:c600a6545e81
--- a/Spikes/Spikes.cpp Tue May 19 13:49:30 2020 +0000 +++ b/Spikes/Spikes.cpp Tue May 19 16:55:43 2020 +0000 @@ -46,13 +46,27 @@ _x = rand() % 37 + 42; _y = 1; } + if (x == 3){ + _y = rand() % 19 + 1; + _x = 1; + } + if (x == 4){ + _y = rand() % 19 + 24; + _x = 1; + } } -void Spikes::update() +void Spikes::updatey() { _y = _y + 3; } +void Spikes::updatex() +{ + _x = _x + 3; +} + + Vector2D Spikes::get_pos() { Vector2D p = {_x,_y}; return p; @@ -62,6 +76,8 @@ { pad.led(1,1); pad.led(4,1); + wait(0.2); + pad.leds_off(); } \ No newline at end of file