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
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:
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:
No comments:
Post a Comment