Jump to content

Search the Community

Showing results for tags 'digital input'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 1 result

  1. 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...