Go Down

Topic: Serial read from sensor (Read 4 times) previous topic - next topic

AWOL

#25
Oct 30, 2009, 11:38 am Last Edit: Oct 30, 2009, 11:42 am by AWOL Reason: 1
OK, try to isolate the problem.
Write a sketch that doesn't have the I2C stuff, and just writes an incrementing count to the LCD every second, and see if that runs on.
Without your exact setup, it is difficult to diagnose.

[edit]Then do the opposite - cut out the LCD, and just write I2C results to the Serial.[/edit]
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

point5

Thanks AWOL - will give it a try.

point5

Hmmm - this routine has been running happily for an hour or so - that's with the sensor connected.  Not sure what to do next?

Code: [Select]
#include <LCD4Bit_mod.h>
LCD4Bit_mod lcd = LCD4Bit_mod(2);

#define address 0x31

#define delayC 1000

char co_str[10];

void setup()
{
 
 lcd.init();
 lcd.clear();
 lcd.printIn("test");
}

void loop()
{
 
 for (int co=0; co >= 0; co++){
 
 lcd.cursorTo(2, 0);
 lcd.printIn(itoa((long)co,co_str,10));
 lcd.printIn(" number  ");
 delay(delayC);
 }
}

AWOL

It doesn't really matter if the sensor is or isn't connected - it's an I2C slave, so unless you talk to it, it won't do a great deal.

Did you try same, but writing the real sensor results to Serial, i.e re-enabling I2C?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

point5

Printing to the serial window rather than the LCD also produces a crash - first try after 35 samples, second time after 49 samples.  The sensor is still blinking away though.

Go Up