Energia: Difference between revisions

From air
Jump to navigation Jump to search
Line 5: Line 5:


==Examples==
==Examples==
[[File:Msp430analogread.jpg|200px|thumb|right|Analog Read (A0)]]
[[File:Msp430analogread.jpg|200px|thumb|right|Analog Read (A0 or P1.0)]]
<pre>
<pre>
const int analogInPin = A0; // Launchpad P1.0 Analog input pin that the potentiometer is attached to
const int analogInPin = A0; // Launchpad P1.0 Analog input pin that the potentiometer is attached to

Revision as of 09:28, 26 February 2013

Energia IDE

Energia is a fork of Arduino’s Processing IDE for TI’s MSP430 microcontrollers.


Examples

Analog Read (A0 or P1.0)
const int analogInPin = A0;  // Launchpad P1.0 Analog input pin that the potentiometer is attached to

int sensorValue = 0;        // value read from the pot

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600); // 4800 with msp430g2231
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);            

  // print the results to the serial monitor:
  Serial.print("sensor = " );                       
  Serial.print(sensorValue);      
  Serial.println();   

  // wait 10 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(10);                     
}

Supported Boards


Pin mapping

https://github.com/energia/Energia/wiki/Hardware#wiki-LaunchPad_MSP430G2452

Links