Jump to content


  • Content Count

  • Joined

  • Last visited

Reputation Activity

  1. Like
    Adson reacted to chicken in I think my interrupt isn't working; Code Help   
    Pin-Interrupts in Energia (and Arduino) are only for digital pins. RISING means the value of the pin changed from LOW to HIGH. You could use this to detect when a button is pressed.
  2. Like
    Adson reacted to energia in I think my interrupt isn't working; Code Help   
    make sure that you input pin is pulled up. You can do this with pinMode(sensorPin, INPUT_PULLUP);
    Also note that A5 is indicating an analog channel. A5 when using it in any of the digital API's translates to pin 5 which is P1.3.
    So rather than using int sensorPin = A5; I suggest that you use uint16_t sensorPin = P1_3.
    Since count is being increased in the interrupt routine, you will need to make it a volatile. Simply said, volatile means that the value can change at any time. so that would be volatile uint8_t count1;
    Below is a small example that will toggle the red LED when the button is pushed.
    int pin = RED_LED; volatile int state = LOW; void setup() { pinMode(pin, OUTPUT); pinMode(PUSH2, INPUT_PULLUP); attachInterrupt(PUSH2, blink, CHANGE); } void loop() { digitalWrite(pin, state); } void blink() { state = !state; }
  3. Like
    Adson reacted to cubeberg in Msp430 Clock Speed   
    16mhz is default for Energia for the 2553.  If you go to Tools -> Board, you'll see which option you have selected.
  • Create New...