Arduino Programming

 Hello,

This week, students are given the following tasks to do individually:

1. To attach and interface a Potentiometer Analog Input to maker UNO

board and measure its signal in serial monitor Arduino IDE

2. Interface an LDR and measure its signal in serial monitor Arduino IDE

3. Interface 3 LEDs (Red, Yellow, Green) to maker UNO

board and program it to perform something (fade or flash

etc)

4. Interface the DC motor to maker UNO board and

program it to on and off using push button on the board


DISCLAIMER : The embedded links for each tasks are in the bottom of the page.


The first task we will carry out the potentiometer:

In this task, I was having a hard time trying to figure out how to use the serial monitor. I have found a youtube video that helped me : https://www.youtube.com/watch?v=xb_0QxeInDs

What I discovered is to attach the following codes:

Serial.begin(9600); Add the following code under the void setup () section

Serial.println(sensorValue); and the following to the void loop () section

https://www.tinkercad.com/things/cOe7NsysUZM-grand-curcan/editel?sharecode=XP_o7hoG35biBnqKegxGoSJE2GE-QfPaj4GkoXav10c

Sorry, you'll have to click the link to see the workings of the board.

2nd Task: Interface an LDR and measure its signal

This task is quite similar to the one above. The video it was referred from is : https://www.youtube.com/watch?v=qvBiVrvc8p8

Here is the code that I used:


The following is the picture of the board:

Link to the work: https://www.tinkercad.com/things/iG0ZOFHU1ox-exquisite-fyyran/editel?sharecode=AysOJ4fbIvhB9hpnW7xsXJyVIPn7kPaq20wTbiTNq2w

3rd Task : Traffic Light

In this task, we were suppose to make a traffic light. In which red, yellow and green LED take turns to light up.

Link to the work: https://www.tinkercad.com/things/h4Da7pwc0tB-mighty-wluff/editel?sharecode=XEkOS4rNpNOT0qPo-LviUWa1p1_94S-vsyKIgrSp1Mk

4th Task:

DC Motor link: https://www.tinkercad.com/things/dBWkEoZ2prq



The codes are:

int buttonState = 0;

void setup()

{

  pinMode(LED_BUILTIN, OUTPUT);

  pinMode(2, INPUT);

}


void loop()

{

  //read state of pushbutton

  buttonState = digitalRead(2);

  //check if the pushbutton is pressed, if it is then 

  //the state is HIGH

  if (buttonState == HIGH){

    digitalWrite(13, HIGH);

  } else {

    digitalWrite(13, LOW);

  }

  delay(10);

  

}

Task 1: 



Task 2: 

Task 3:


Task 4: 

No comments:

Post a Comment

About