Jump to content

hard2tell

Members
  • Content Count

    1
  • Joined

  • Last visited

  1. Hi All I have only a tiny shred of experience on the msp430. I have had some luck using Arduino platforms. So far all I have been able to do with the msp is to use it as an ultra low power timer. What I need to see is a translation of some simple arduino code into MSP format. I have scoured the code examples but cant find what I need, or cant understand it. Here is one such snippet. Thanks in advance for any help. const int analogPin = A0; // pin that the sensor is attached to const int ledPin = 13; // pin that the LED is attached to const int threshold = 400; // an arbitrary threshold level that's in the range of the analog input void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize serial communications: Serial.begin(9600); } void loop() { // read the value of the potentiometer: int analogValue = analogRead(analogPin); // if the analog value is high enough, turn on the LED: if (analogValue > threshold) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin,LOW); } // print the analog value: Serial.println(analogValue, DEC); }
×
×
  • Create New...