Hello,
Not sure how to do this.. I want to enter say "A" or "B" and click send in the serial monitor and then have an LED change brightness..
But I'm getting "invalid conversion from 'const char*' to 'char'" ERROR..
so how do i compare text/data from the serial port to a value?
--- my code --
int ledPin = 9; // LED connected to digital pin 9
void setup()
{
// initialize the serial communication:
Serial.begin(9600);
}
void loop() {
char srlcmd;
if (Serial.available()) {
srlcmd = Serial.read();
if (srlcmd = "A" )
{
analogWrite(ledPin, 1);
}
else if (srlcmd = "B" )
{
analogWrite(ledPin, 25);
}
}
delay(30);
}
-- end my code--
Thanks for any help!!!
Shane