Jump to content

Search the Community

Showing results for tags 'switch'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 3 results

  1. Hey all, I'm completely stumped on a bug for my design day project. I've got a rotary encoder that is used to change a value on an LCD screen. The code works perfectly when the encoders state at power up is 00. However if either pin is high, it doesn't work at all. Some transitions will cause the value on the screen to move in the wrong direct, and some transitions don't seem to trigger an interrupt at all. This is the code I'm using and would LOVE some help! Is it possible that the MSP430 is recording the initial values as reference voltages causing subsequent interrupts to not work? #pragma vector=PORT2_VECTOR //Port 2 interrupt triggered by either rotary encoder pin __interrupt void Port_2(void) { //int gray0=P2IN&GRAY0; //int gray1=P2IN&GRAY1; if(P2IFG&GRAY0) { (P2IN&GRAY1)? parameter++ : parameter-- ; if(parameter>999) parameter=0; P2IFG&=~GRAY0; } else if(P2IFG&GRAY1) { (P2IN&GRAY0)? parameter++ : parameter-- ; P2IFG&=~GRAY1; if(parameter<0) parameter=999; } inactivity=0; //interaction has been seen, so reset the inactivity counter }
  2. I am a newbie to Stellaris. I have a LM4F120H5QR launchpad with me. I just want to poll a switch and at least turn on an LED. all i want to do is: if(button pressed){ turn on the led; } For this do I need to use the ButtonPoll() API as per the Lab3 of the stellaris wiki. I cannot really understand the code much, i mean i know what bouncing is but i did not see how they actually poll the switch in the buttons.c. For example what is that g_s_Appstate or something which is there in the code. Please help me.
  3. Hi. First of all I would like to thank developers and supporters of Energia as well as 43oh.com for their wonderful efforts. I have worked on Arduino for quite a bit of time now and am now trying on the MSP430, of course using the launchpad. Recently, I wrote a code in Arduino which reads the value of 4 push-to-on switches and positions the servo according to the switch state. For example, following cases happen : if no switch is pressed, the servo remains at 0, if two switches are pressed, servo moves to say 30 degrees and so on. For this, I have used switch-case control, switching the total sum of switch states, which were stored in an integer array. Now the problem is that this code works perfectly with Arduino, but when tried with Energia on MSP430G2553, the servo oscillates between 2 or three values randomly and never gets a fixed position. The serial monitor shows different values for example, 2, 3, 3, 4, 2, 3,...... and the servo will oscillate between these values according to the switch case. This all happens irrespective of the switch states. I think my code is fine as it works perfectly in Arduino and i have checked all the pin assignments and the connections a million times but nothing gets this to work. May be I am missing something in the transition from Arduino to MSP430 or something else is wrong. Please correct me where I am wrong. Also if anyone thinks this approach is not good enough and has a better idea is welcome to share. Thanks Smat // servo control using switches at 3 4 5 6 for #include <Servo.h> int sen[]={3,4,5,6}; //switch connections Servo myservo; //servo object int pos = 0; // variable to store the servo position unsigned int sum; int f, r, t, m; int load[]={f, r, t, m}; // array to store switch values 0 or 1 void setup() { for(int i= 0; i< 4; i++) { pinMode(sen[i], INPUT); // declare pushbutton as input digitalWrite(sen[i],HIGH); // internal pull up enable Serial.begin(9600); } myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { sum=0; // int vairable to store the sum of load array for(int j=0; j<4; j++) { load[j]=digitalRead(sen[j]); sum = sum + load[j]; delay(30); } Serial.print(sum); Serial.println(); switch(sum) { case 0: myservo.write(100); //delay(2000); break; case 1: myservo.write(75); //delay(2000); break; case 2: myservo.write(50); //delay(2000); break; case 3: myservo.write(25); //delay(2000); break; case 4: myservo.write(0); //delay(2000); break; //default: //delay(500); } }
×
×
  • Create New...