Author Topic: Stops working after restart.  (Read 2578 times)

aznproto

  • Newbie
  • *
  • Posts: 1
Stops working after restart.
« on: August 06, 2014, 07:38:52 pm »
I recently purchased a Digispark to create a program. The program uses a loop that looks at PIN 4 as INPUT and when it is LOW(button pressed) the space key is outputted to the computer. It is working fine however if I leave the digispark plugged in and restart or turn my computer on it will not work unless I unplug the digispark and plug it back in. Is there a way for me to fix this?

Thanks

defragster

  • Sr. Member
  • ****
  • Posts: 467
Re: Stops working after restart.
« Reply #1 on: August 07, 2014, 11:34:03 am »
I'd put an out put signal on another pin and power an LED that shows when the input on #4 is seen low.  I suspect when the comm fails to register the 'space' on the PC the program is still running and you'll see the LED light change/toggle when the button is pushed.  Perhaps your use of pin 4 is interfering with some other function, or the USB connection is failing to be restored or maintained over time until a full reset happens.  This sounds like a short program you could post here as well.

dougal

  • Sr. Member
  • ****
  • Posts: 289
Re: Stops working after restart.
« Reply #2 on: August 13, 2014, 05:58:15 am »
Pins 3 and 4 are used for USB communications. If you're trying to use P4 as an input, I'd imagine that would cause all sorts of USB communication errors. Try moving your button input to another pin, maybe P5, since it's just a digital input.

See also:
http://digistump.com/wiki/digispark/tutorials/basics