You are on page 1of 4

 

IoT Computer Sciences 


IoT quiz 
 

Lhet Mombonhinhi Eny Vieyrrah Magnan 


17th February, 2021 
 

   

 
 

1 Fritzing simulating 
Items used: 

● Arduino nano board. 


● Breadboard. 
● Resistor 
● Push-button. 
● LED 
● Jumper cables. 

   


 

2 The program that will control the connected items. 


The program controlling the connected items: 

In case the picture above is not readable, the code below is the same as the one in the 
picture: 

int led = 7; (D4) 

int button = 5; (D2) 

int buttonState=0; 

//setup function managing the let and the button. Output for the led and input for the button. 

void setup() { 

pinMode(led, OUTPUT); 

pinMode(button, INPUT); 


 

//Loop function to manage the state of the led. To turn off the led and to turn on the led. 

void loop() { 

  

buttonState = digitalRead(button); 

  

// The button is on by default so when clicking on the button it will become off 

if (buttonState == 1) 

digitalWrite(led, LOW);  

delay(200); 

if (buttonState==0) 

digitalWrite(led, HIGH);  

delay(200); 

You might also like