int ledPin = 13;
int buttonPin = 2;
int buttonState = LOW;
int oldButtonState = HIGH;
char serInput;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
digitalWrite(ledPin, HIGH);
Serial.begin(115200);
}
void loop()
{
buttonState = digitalRead(buttonPin);
if (Serial.available() > 0)
{
serInput = Serial.read();
Serial.println("Miny, Moe.");
}
if (buttonState != oldButtonState)
{
if (buttonState == HIGH)
{
digitalWrite(ledPin, HIGH);
Serial.print("Meeny, ");
}
else
{
digitalWrite(ledPin, LOW);
Serial.print("Eeny, ");
}
}
oldButtonState = buttonState;
}
This example will actually work with both the standard USB serial connection, or a
BlueSMiRF. Give it a try! Note that the baud rate is set to 115200 bps, this is the
default baud rate of the BlueSMiRF. Pressing the button will turn the LED off and
Need help?
Do you have a question about the ProtoShield and is the answer not in the manual?
Questions and answers