Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Good day all,
I am trying to write a simple code that will return and store, in a txt file, the values of the five reflection sensors. I included m3pimaze.h library (http://mbed.org/users/jonmarsh/libraries/m3pimaze/lngdpc) which should allow me to do exactly that using readsensor(int *sensor). The problem is that, when I open the txt file, the returned values are 0, all the time, even if I change the surface (black/white) beneath the sensors. This is the code I am currently using:
#include "mbed.h" #include "m3pimaze.h" m3pi m3pi(p23,p9,p10); LocalFileSystem local("local"); int main() { FILE *fp = fopen("/local/out.txt", "w"); int n; for(n=0; n<10; n++){ int sensor[5]; m3pi.readsensor(sensor); fprintf(fp, "S1: %i S2: %i S3: %i S4: %i S5: %i\n", sensor[0],sensor[1],sensor[2],sensor[3],sensor[4]); wait(1); } fclose(fp); }Do you guys know what am I doning wrong?
Thank you in advance.
All the best, Igor