NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » dipswitch: 7+7=14, but then 0+0=01
January 10, 2012 by jeffspc88mx |
In the last bit of the dipswitch project code, I'm writing the values of the 2 "bytes" (3-bit bytes, I know) to the LCD with:
...and that works, but when I try to add these two expressions with...
...I get various nonsense answers, and always a leading zero, and never "00" - always some positive non-zero number. I'm a C novice, but a VBA journeyman; is my syntax wrong for C? |
---|---|
January 10, 2012 by pcbolt |
Try:
It may be a casting problem. |
January 11, 2012 by hevans (NerdKits Staff) |
Hi pcbolt, I have a theory, try adding this line
right after this line
and let me know what happens. |
January 11, 2012 by pcbolt |
Hi Humberto - Think you want jeffspc88mx. Glad to get a response, tho =) |
January 11, 2012 by Rick_S |
|
January 14, 2012 by jeffspc88mx |
2 pts. for Humberto! 'Twas the trailing digit. After generating a two digit answer, it wasn't erasing the second digit when it was time to report a 1 digit answer. So...
and so on. Forcing it to write some space after the answer wipes the trailing zero. |
Please log in to post a reply.
Did you know that a NerdKit can be used to build an iPhone-controlled R/C car? Learn more...
|