Introduction: MSP430 SERIAL COMMUNICATION USING ENERGIA AND PROCESSING

Hi everyone . i am vigneshraja. here i done the varying the color depending upon the analog value read from 10 k potentiometer using MSP430G2231. i am using Energia software for serial communication program. for varying the color of window i am using Processing software.

Step 1: Circuit Connection of 10k Potentiometer With Msp430 Launchpad

Step 2: Coding With Energia Software

The program code for energia to read 10k potentiometer
value:

void setup()

{

Serial.begin(4800); // start serial communication

}

void loop()

{

int value = map(analogRead(A0), 0, 1023, 0, 255); //read value of pod and convert to 8 bit variation

Serial.println(value); // print the read value in serial monitor

}

for download energia software visit the link bellow:

http://energia.nu/download/

Step 3: Coding With Processing Software

The code for processing software to change the color
according to the pod value:

import processing.serial.*;

Serial port;

float brightness = 0;

void setup()

{

size(500,500);

port = new Serial(this, "COM4", 4800); // select the COM port shown bellow in the energia IDE port.bufferUntil('\n');

}

void draw()

{

background(brightness,0,0);

}

void serialEvent (Serial port)

{

brightness = float(port.readStringUntil('\n'));

}

for download Processing software visit the link bellow:

https://www.processing.org/download/?processing

Thank you for watching