Two Output Code in Tinkercad Circuits

Now let's try 2 outputs at once.

Type the following code into the text section of your circuit creation. Ensure you look out for correct case (e.g. OUTPUT, pinMode, digitalWrite, etc.) and semi-colons.

Your circuit should now look something like this:

Questions.

  1. Suggest why this code does not need the if... else statement.
  2. When would you need to add the else statement?
  3. How do we make the LED and Buzzer stay on longer or shorter?
  4. Can you make the LED and Buzzer alternate (that is, LED on and Buzzer off, then LED off and Buzzer on)?
  5. What additional lines of code would be needed to add another LED to this program?

Now see if you can access open source code and modify it to work in Tinkercad Circuits.