We've already visited this site, but our problem is the code.. In fact we wrote a program to calibrate CMPS03, but it doesn't run.
The program was:
//Includes di Society of robots
#include "SoR_Utils.h" //includes all the technical stuff
#include "hardware.c" //declare hardware variables and ports
//#include "sensors.c" //sensor libraries for sonar, sharp IR, etc.
//#include "misc.c" //ha al suo interno le due funzioni per far funzionare i due azionamenti
#include "a2d.h" //per sensori
//#include "uart4.h" //per protocollo di comunicazione
#include <stdio.h>
#include "i2c.c"
#include "rprintf.h" // include printf function library
char n;
int i = 0;
int main(void)
{
rprintf("WAIT...\n");
i2cInit();
i2cSetBitrate(2); //set I2C transaction bit rate in kHz
rprintf("WAIT...\n");
//i2cSetLocalDeviceAddr(LOCAL_ADDR, TRUE); //set local device address and allow response to general call
/*
//set the Slave Receive Handler function
// this function will run whenever a
// master somewhere else on the bus
// writes data to us as a slave
i2cSetSlaveReceiveHandler(i2cSlaveReceiveService);
//set the Slave Transmit Handler function
// this function will run whenever a master
// somewhere else on the bus
// attempts to read data from us as a slave)
i2cSetSlaveTransmitHandler(i2cSlaveTransmitService);
*/
//Send I2C start condition in Master mode
i2cSendStart();
/*
//Send I2C stop condition in Master mode
i2cSendStop();
//Wait for current I2C operation to complete
i2cWaitForComplete();
//Send (address|R/W) combination or a data byte over I2C
i2cSendByte(data);
*/
while(1)
{
rprintf("waiting..\n");
n = uart1GetByte();
if(n == 'f')
{
//Send (address|R/W) combination or a data byte over I2C
i2cSendByte(0xff);
rprintf("sent!!\n");
i++;
if(i == 4) break;
}
}
i2cSendStop(); //Send I2C stop condition in Master mode
}
(the part of the code used to manage the i2c is taken by the site of axon)
With this program we want to calibrate each of the four cardinal pIonts sending 'f' by the terminal of ubuntu. But, like I said, this doesn't work
SOMEONE HAS AN IDEA?

?