In this document we describe the assignment to be completed before taking Quiz 1. Each part of the
assignment should be solved in the online Arduino simulator Tinkercad. In this simulator, you are able to create
circuits in the browser using drag and drop of components. You can go the tab “Code” and write the C code for
the circuit created. Finally you simulate the circuit by clicking on “Start Simulation”.
Please study the Arduino API for more information regarding the coding functions
https://www.arduino.cc/reference/en/
You first step is to register on https://www.tinkercad.com after this, solve the questions in parts 1 to 5 in this
document. After this you can complete Quiz 1 on the Coursera page.
Part 1
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
digitalWrite(12,HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(13, LOW);
digitalWrite(12, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
Part 2
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
}
void loop()
{
for(int i = 13; i > 6; i--){
digitalWrite(i, HIGH);
delay(SPEED);
digitalWrite(i, LOW);
delay(OFF);
}
Part 3
void loop() {
digitalWrite(0, state);
}
void blink() {
state = !state;
}
Part 4
void setup()
{
pinMode(A0, INPUT);
pinMode(8, OUTPUT);
}
void loop()
{
if (analogRead(A0) < 150) {
digitalWrite(8, HIGH);
}
digitalWrite(8, LOW);
delay(10);
}
Part 5