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 FATFileSystem
Diff: CaMove/CaMove.cpp
- Revision:
- 8:e3a76a808a4c
- Parent:
- 5:860087ff295e
- Child:
- 9:ac396c818874
diff -r cbec3402b4e3 -r e3a76a808a4c CaMove/CaMove.cpp --- a/CaMove/CaMove.cpp Sun Apr 21 01:15:49 2019 +0000 +++ b/CaMove/CaMove.cpp Tue Apr 23 21:46:55 2019 +0000 @@ -1,5 +1,5 @@ #include "CaMove.h" -#include "FilePaths.h" +#include "AniPaths.h" //Constructor CaMove::CaMove(PinName Button, PinName Pot_h, @@ -31,19 +31,21 @@ void CaMove::move(N5110 &lcd) { //If statements to check joystick movement and has in bluilt collsion detection //collsion detection check 4 sides for black pixels - if (_hoz->read() > 0.6f && lcd.getPixel((_h-1),(_v+7)) == 0) { + bool pi = (lcd.getPixel((_h-1),(_v+7)) == 0) && (lcd.getPixel((_h+10),(_v+7)) == 0) && + (lcd.getPixel((_h+5),(_v-1)) == 0) && (lcd.getPixel((_h+5),(_v+14)) == 0); + if (_hoz->read() > 0.6f && pi) { _h = _h - 2; _fc = Lt; } - if (_hoz->read() < 0.4f && lcd.getPixel((_h+10),(_v+7)) == 0) { + if (_hoz->read() < 0.4f && pi) { _h = _h + 2; _fc = Rt; } - if (_ver->read() > 0.6f && lcd.getPixel((_h+5),(_v-1)) == 0) { + if (_ver->read() > 0.6f && pi) { _v = _v - 2; _fc = Fd; } - if (_ver->read() < 0.4f && lcd.getPixel((_h+5),(_v+14)) == 0) { + if (_ver->read() < 0.4f && pi) { _v = _v + 2; _fc = Bd; }