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'));
}
I need help for multiplication two signal in msp 430. Can you help me? My adress ludm1l4@hotmail.com
ReplyDelete