Joe Shotton / Mbed 2 deprecated ELEC2645_Project_ll16j23s

Dependencies:   mbed ll16j23s_test_docs

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);
 }