I've got a bit of a weird problem building my library and I can't figure it out. I have a function that the external code calls, and this function returns zero. The external code has a while loop that checks this return value and breaks out of the loop when it's zero.

So you'd think the loop would never run, right? Well the Arduino locks up in the loop...

uint8_t get_value() { return 0;}void external_function() { while (get_value()) { // do stuff }}Given that the code locks up only when the while loop is present I put a debugging command in to find out what get_value() is returning, and it came out as 2048! That's why the loop runs forever. How you get 2048 from a "return 0;" is beyond me though...any suggestions??

Unfortunately now I can't tell :-( It works as a char, but it is also working now if I take out the uint8_t cast. Perhaps that memory location is all zero now so it will work until it changes again...?