virtual terminal in proteus is located at logo which highlighted as Instruments and can be located
in the instruments we can choose the virtual instrument
we can select the serial transmission characteristics such as baud rate, parity... etc
code which is dumped into Arduino is
const int pin = 13;
void setup()
{
pinMode(pin,OUTPUT);
Serial.begin(9600);
Serial.println("enter y to ON and n to OFF");
}
void loop()
{
while(!Serial.available())
{
//wait until user enters the data
}
if(Serial.available())
{
char input = Serial.read();
switch(input)
{
case 'y':
Serial.println("you entered y led ON");
digitalWrite(pin,HIGH);
break;
case 'n':
Serial.println("you entered n led is OFF");
digitalWrite(pin,LOW);
break;
default:
Serial.println("you entered wrong character");
}//end of switch
}//end of If
}//end of loop
No comments:
Post a Comment