MSP430 SERIAL COMMUNICATION USING ENERGIA AND PROCESSING

on Saturday, February 15, 2014
         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.

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
  } 




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'));
}

1 comments:

Carla said...

I need help for multiplication two signal in msp 430. Can you help me? My adress ludm1l4@hotmail.com

Post a Comment