NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » Putty stuck at scanf_P

August 09, 2010
by kle8309
kle8309's Avatar

hi, does anyone know why putty get stuck at scanf_P. I can't get it to go to printf_P even though I entered a number and entered.

int num; printf_P(PSTR("Please enter your number:rn")); scanf_P(PSTR("%d"),&num); printf_P(PSTR("Your num is:%drn"),num);

August 09, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi kle8309,

Your code works on my NerdKit here. I get my number right back over the serial port. Is your programming cable perhaps loose? Are you able to program your kit just fine? Can you post the rest of your code, there might be an error in the rest of the program structure. Remember to indent the code block with at least 4 spaces in order to make sure the code block gets formatted correctly.

Humberto

August 10, 2010
by kle8309
kle8309's Avatar

It has came to my attention that the putty requires a connection reset in order for scanf to work. The reset is done by turn off the power then switching the spdt switch to programming mode then turn on the power. Next, turn off the power and switch back to run mode.
Another way is to unplug the usb and replug it.

August 10, 2010
by kle8309
kle8309's Avatar

After unplugging the usb and replugging it, it seems like the problem is solved. Scanf worked perfectly times after times.

My next concern is that when I entered a backspace tab, the putty starts repeat itself in an infinite loop.

August 10, 2010
by kle8309
kle8309's Avatar

I believe that putty is reacting to non int input since I specified that an int was the input.

Post a Reply

Please log in to post a reply.

Did you know that you can make a spooky Halloween Jack-O-Lantern with a microcontroller? Learn more...