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 ll16j23s_test_docs
Diff: Food/Food.cpp
- Revision:
- 5:06fa7674622a
- Parent:
- 4:ea3fa51c4386
- Child:
- 6:6c9453397f4a
diff -r ea3fa51c4386 -r 06fa7674622a Food/Food.cpp
--- a/Food/Food.cpp Sat May 23 15:31:30 2020 +0000
+++ b/Food/Food.cpp Sat May 23 17:16:44 2020 +0000
@@ -3,7 +3,7 @@
Food::Food()
{
//constructor
- _x = 42; // starts off-screen
+ _x = 22; // starts off-screen
_y = 30;
_frame = 0;
srand(3); //CHANGE THIS TO ACCELERAOMETRE VALUE
@@ -14,9 +14,12 @@
//deconstructor
}
-void Food::init()
+void Food::init(FXOS8700CQ &mag)
{
- //rand_pos(pad, _x, _y);
+ mag.init();
+ Data _values = mag.get_values();
+ _seed = 10000*(_values.mx + _values.my + _values.mz);
+ srand(_seed);
}