Whould this program work to turn on an LED? I wrote this based off of a previous post. I want to use this for another program.
int pin12 =12; //LED Pin
int pin2 =2; //Button Pin
int pin2status;
void setup()
{
Serial.begin (9600);
pinMode (pin12, OUTPUT); //sets LED pin as OUTPUT
pinMode (pin2, INPUT; //sets button pin as INPUT
pin2status = digitalRead(pin2); //sets variable for pin2
}
void loop ()
{
pin2status = digitalRead(pin2); //reads button pin
if (pin2status == LOW)
{
} //do nothing
if (pin2status == HIGH) //if button is pressed
{
digitalWrite (pin12,HIGH); //then turn on LED
}
}
If this works how could I modify it so when the button is pressed a command is sent to a MAX232 (or similar chip) and out through hyperterminal?
I noticed this tutorial:
But I'm not sure how to incorporate the SW commands into this program.
Also, is there a way to display the output and input to the MAX232 on an LCD?
I haven't received my arduino board yet so I can't test this program out. Please help if possible.