hi,
im getting faults in my c-syntax and i dont know why.
what i want to do:
im sending a command (1) to ctrl register (0), this will start a measure, after this measure is finished the ic will automatically reset the ctrl register, i only want to wait the time needed to wait, so im waiting till the ctrl register is 0 again:
code
void startmeting() we zetten het ctrl register (0) op 1 zodat er een meting uitgevoerd wordt
deze 1 wordt na de meting automatisch terug gereset
{
char sendstartsample[2]={0,1}; sturen eerst 0(register) en dan een 1 (weg te schrijven waarde)
i2c.write(addr, sendstartsample, 2, 0); 0 en 1 worden naar slave geschreven
while(leesregister(0x00) != '0');
pc.printf("\n\r meting is gedaan");
}
void leesregister(char adres)
{
char terugstuurwaarde;
i2c.write(addr, adres, 1, 0);
i2c.read(addr, *terugstuurwaarde, 1, 0);
return terugstuurwaarde;
}
thnx in advance
the faults i get when i try to compile:
"expression must have arithmetic, enum, or pointer type" in file "/main.cpp", || while(leesregister(0x00) != '0');
"no instance of overloaded function "mbed::I2C::write" matches the argument list" in file "/main.cpp", Line: 65, Col: 34 || i2c.write(addr, adres, 1, 0);
"operand of "*" must be a pointer" in file "/main.cpp", Line: 66, Col: 16 || i2c.read(addr, *terugstuurwaarde, 1, 0);
"return value type does not match the function type" in file "/main.cpp", Line: 67, Col: 7 || return terugstuurwaarde;
thnx in advance
hi, im getting faults in my c-syntax and i dont know why. what i want to do: im sending a command (1) to ctrl register (0), this will start a measure, after this measure is finished the ic will automatically reset the ctrl register, i only want to wait the time needed to wait, so im waiting till the ctrl register is 0 again:
code
void startmeting() we zetten het ctrl register (0) op 1 zodat er een meting uitgevoerd wordt deze 1 wordt na de meting automatisch terug gereset { char sendstartsample[2]={0,1}; sturen eerst 0(register) en dan een 1 (weg te schrijven waarde)
i2c.write(addr, sendstartsample, 2, 0); 0 en 1 worden naar slave geschreven
while(leesregister(0x00) != '0');
pc.printf("\n\r meting is gedaan");
}
void leesregister(char adres)
{
char terugstuurwaarde;
i2c.write(addr, adres, 1, 0);
i2c.read(addr, *terugstuurwaarde, 1, 0);
return terugstuurwaarde;
}
thnx in advance
the faults i get when i try to compile:
"expression must have arithmetic, enum, or pointer type" in file "/main.cpp", || while(leesregister(0x00) != '0');
"no instance of overloaded function "mbed::I2C::write" matches the argument list" in file "/main.cpp", Line: 65, Col: 34 || i2c.write(addr, adres, 1, 0);
"operand of "*" must be a pointer" in file "/main.cpp", Line: 66, Col: 16 || i2c.read(addr, *terugstuurwaarde, 1, 0);
"return value type does not match the function type" in file "/main.cpp", Line: 67, Col: 7 || return terugstuurwaarde;
thnx in advance