Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Next »

Using Serial Communication

Method used to transfer data between two devices.


Serial Monitor & analogRead()

Sending a Message

void setup()

{

  // initialize serial:

  Serial.begin(9600);

}

void loop ( )

{

  Serial.print(“Hands on ”) ;

  Serial.print(“Learning ”) ;

  Serial.println(“is Fun!!!”) ;

}


Homework Exercise

  • Modify your program such that
    • When the switch is off
      • The message OFF is repeatedly printed via Serial, and the system will not do anything else
    • When the switch is on
      • The LED will gradually turn on or off at a speed which is related to the amount of light failing on the LDR
      • The message ON is repeatedly printed via Serial
  • Use a Serial bit/baud rate of 115200 instead of 9600 for the above
  • No labels