const int ledPin = 6; // the pin that the LED is attached to
void setup()
{
// initialize the serial communication:
Serial.begin(9600);
// initialize the ledPin as an output:
pinMode(ledPin, OUTPUT);
}
void loop() {
byte brightness;
// check if data has been sent from the computer:
if (Serial.available()) {
// read the most recent byte (which will be from 0 to 255):
brightness = Serial.read();
// set the brightness of the LED:
analogWrite(ledPin, brightness);
}
Serial.println(brightness);
delay(500);
}
i want to do like this, which mean during the serial monitor, i would like to insert "255" means max pwm... then the num "255: will eventually insert into one of the coding to initalize motor at pwm "255" pwm..huuuuu
thanx in advance...8)... i try yours bubulindo..but smehow i dont get it....