none
serial monitor cannot read input and communicate to arduino RRS feed

  • Question

  • enter 1 and hit send but nothing happens, on the Arduino IDE itself, it accepts my character and give a 'HIGH' signal which you can measure with a metre.

    I am new to visual studio and cannot figure out how to make the serial monitor interact with the arduino using VISUAL STUDIO 2015.
    Can anyone who has encountered and solved this help?
    Picture attached

    const int outPin = 3;
    void setup()
    {
    
      /* add setup code here */
      pinMode(outPin, OUTPUT);
      Serial.begin(115200);
      Serial.println("Enter 1 or 0");
    
    }
    
    void loop()
    {
    
      /* add main program code here */
      if (Serial.available() > 0)
      {
    	  char ch = Serial.read();
    	  if (ch == '1')
    	  {
    		  digitalWrite(outPin, HIGH);
    	  }
    	  else if (ch == '0')
    	  {
    		  digitalWrite(outPin, LOW);
    	  }
      }
    
    }
    

    Friday, May 13, 2016 9:45 AM

Answers

All replies