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.
Diff: Reket.cpp
- Revision:
- 0:a5f6ba8c378e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Reket.cpp Thu Jun 05 17:37:09 2014 +0000 @@ -0,0 +1,67 @@ +#include "Reket.h" + +int Reket::dajX1() +{ + return x1; +} + +int Reket::dajX2() +{ + return x2; +} + +int Reket::dajY1() +{ + return y1; +} + +int Reket::dajY2() +{ + return y2; +} + +void Reket::crtajReket(N5110 &display) +{ + for(int i = y1; i <= y2; i++) + { + display.setPixel(x1, i); + display.setPixel(x2, i); + } + + display.refresh(); +} + +void Reket::brisiReket(N5110 &display) +{ + for(int i = y1; i <= y2; i++) + { + display.clearPixel(x1, i); + display.clearPixel(x2, i); + } + + display.refresh(); +} + +void Reket::osvjeziPoziciju(AnalogIn &p1) +{ + if (p1 < 1.0/3.0) + { + y1 -= 2; + y2 -= 2; + if(y1 < 0 or y2 < 7){ + y1 = 0; + y2 = 7; + } + } + + if (p1 > 2.0/3.0) + { + y1 += 2; + y2 += 2; + if(y2 > 47 or y1 > 40) + { + y2 = 47; + y1 = 40; + } + } +} \ No newline at end of file