Jump to content


  • Content Count

  • Joined

  • Last visited

Reputation Activity

  1. Like
    Marija reacted to abecedarian in MSP430 project for motor control using multiple ISR   
    With an analog input, you likely wouldn't want to set a pull-up or pull-down state. However, with digital inputs, and without setting the input as INPUT_PULLUP or INPUT_PULLDOWN in the sketch or using an external pull-up or pull-down resistor, the input pin will float, as in won't have a default state, and this can cause issues like false or missed triggers.
    So, if the switch connects to ground when pushed, either set internal pull-up in the sketch or provide an external resistor (10K should work) pull-up to VCC. If the switch connects to VCC when pushed, either set internal pull-down in the sketch or provide an external weak pull-down resistor to ground.
  2. Like
    Marija reacted to Fmilburn in MSP430 project for motor control using multiple ISR   
    Hi @Marija
    A couple of thoughts and questions about what you are trying to do:
    There is the following comment in your code , but then you fail to use INPUT_PULLUP in the call to pinMode.  This looks like it might be the problem - try fixing it first.
    /* Enable internal pullup. * Without the pin will float and the example will not work */ What is the purpose of the variable called flag?  I can't see that you are doing anything useful with it attachInterrupts is in the right place (i.e. setup) since you are setting it once and aren't changing it.  I don't think the length of the ISR is the problem here although you are correct it should be minimized.  Have you tried using serial print to the monitor to debug / see what state you are in and how it is changing?  It might capture bouncing of the switches that your LED might miss You aren't using the variables lastDebounceTime and debounceDelay.  This is confusing to someone trying to help debug your code.  It is not that much more complicated to debounce 3 switches.  Try adding it next if you still have a problem after enabling the pullup.
  • Create New...