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: main.cpp
- Revision:
- 9:fa745d3afcac
- Parent:
- 8:6da192ba2dfb
- Child:
- 10:d18768e771ac
--- a/main.cpp Wed Nov 21 12:10:20 2018 +0000 +++ b/main.cpp Wed Nov 21 12:22:22 2018 +0000 @@ -12,7 +12,7 @@ #define I_TERM 0 #define D_TERM 8 -int sensor_all(int i) //lav en funktion? ved ikke hvad jeg skal her +void sensor_all(void) //lav en funktion? ved ikke hvad jeg skal her { int sensor_value[5]; // sensor int m3pi.putc(0x86); // send noget sensor data @@ -23,7 +23,10 @@ char hibyte = m3pi.getc(); sensor_value[n] = ((lowbyte + (hibyte << 8))); // sensor value } - return sensor_value[i]; //return sensor value string + m3pi.cls(); + m3pi.locate(0,1); + m3pi.printf("%d", sensor_value[0]); + return 0; //return sensor value string } int main() { @@ -43,11 +46,7 @@ float power; float speed = MAX; - int sensor_value0; - int sensor_value4; - while (1) { - // Get the position of the line. current_pos_of_line = m3pi.line_position(); proportional = current_pos_of_line; @@ -84,14 +83,10 @@ m3pi.right_motor(right); //Marc's sensor test - - m3pi.cls(); - sensor_value0 = sensor_all(0); // sensor_value gets fkt value + sensor_all(0); // sensor_value gets fkt value /* sensor_value4 = sensor_all(4); // sensor_value gets fkt value */ - m3pi.locate(0,0); - m3pi.printf("Hej Marc"); /* m3pi.printf("%d", sensor_value0); // prints one of sidesensors value