Microcontroller Lab2 MJII

Microcontroller Lab2 MJII This lab is used for
1)C programming.

2)Microcontroller&Embedded System and

3)Object Oriented Programming. Do check our activity out!!

15/11/2022

"CAR'S COUNTER"
By :
NURUL WAHIDAH BINTI HANAFIAH
ALICE PRISSILA BT AKIAM
CLASS : WASEDA (EMBEDDED SYSTEM)
SESSION : JAN-JUN 2017
PROJECT NAME : CARโ€™S COUNTER
Introduction :
1) To develop an automatic system using Arduino Mega 2560
R3.
2) To apply the coding of count in Arduino.
3) To make a system that can notify when parking is full on
Liquid Crystal Display (LCD).
Components :
1) Arduino Mega 2560 R3.
2) LCD keypad shield
3) 8 X LED module
4) Photo-electric sensor module
5) Male to female wire jumper
6) Male to male wire jumper
7) Breadboard
Coding :

LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //Declared the no pin of lcd, no pin must be follow the datasheet (RS, E, D4, D5, D6, D7)
//The condition state of COUNT is '0', so it will start and count from '0' first
int count=0;
//This void setup for declared the input & output and also the number pin of arduino that we used.
void setup()
{
lcd.begin(16,2);
//The lcd will display 'CARS COUNTER' for awhile when the lcd connect with supply
lcd.print("CAR'S COUNTER:");
delay(500);
pinMode(44, INPUT);
//Declared the no pin of sensor 1, and we used pin number 44 on arduino. The is an input as SENSOR 1.
pinMode(45, INPUT);
//Declared the no pin of sensor 2, and we used pin number 45 on arduino. The is an input as SENSOR 2.
delay(500);
lcd.clear();
lcd.print("CAR TOTAL:");
lcd.setCursor(0,1);
lcd.print(count);
//This is an input as parking sensor that will detect the car, and we declared the pin number of arduino is (22, 23, 24, 25).
pinMode(22,INPUT);//SENSOR PARKING 1
pinMode(23,INPUT);//SENSOR PARKING 2
pinMode(24,INPUT);//SENSOR PARKING 3
pinMode(25,INPUT);//SENSOR PARKING 4
//This is an output as led that will blink when the sensor detect, and we declared the pin number of arduino is (50, 51, 52, 53).
pinMode(50,OUTPUT);//LED 1
pinMode(51,OUTPUT);//LED 2
pinMode(52,OUTPUT);//LED 3
pinMode(53,OUTPUT);//LED 4
}
//This void loop will read the programme as we want.
void loop()
{
if(digitalRead(44)==LOW)//The car will go through the sensor 1 first
{
delay(500);
if(digitalRead(45)==LOW)//Then, go through to the sensor 2
{
//When the SENSOR 1 detects the car first and then go to the sensor 2, it will count increase
count++;
lcd.clear();
lcd.print("CAR TOTAL:");
lcd.setCursor(0,1);
lcd.print(count);
delay(500);
}
}
if(digitalRead(45)==LOW)
{
delay(500);
if(digitalRead(44)==LOW)
{
//When the SENSOR 2 detects the car first and then go to the sensor 1, it will count decrease
count--;
lcd.clear();
lcd.print("CAR TOTAL:");
lcd.setCursor(0,1);
lcd.print(count);
delay(500);
}
}
//If the 22=PARKING SENSOR 1 detects the car, LED 1 will turn ON indicates the parking in is filled by car
if(digitalRead(22)==LOW)
{
digitalWrite(50,HIGH);
digitalWrite(51,LOW);
digitalWrite(52,LOW);
digitalWrite(53,LOW);
}
//If the 23=PARKING SENSOR 2 detects the car, LED 2 will turn ON indicates the parking is filled by car
if(digitalRead(23)==LOW
{
digitalWrite(51,HIGH);
}
//If the 24=PARKING SENSOR 3 detects the car, LED 3 will turn ON indicates the parking is filled by car
if(digitalRead(24)==LOW)
{
digitalWrite(52,HIGH);
}
//If the 25=PARKING SENSOR 4 detects the car, LED 4 will turn ON indicates the parking is filled by car
if(digitalRead(25)==LOW)
{
digitalWrite(53,HIGH);
}
else
{
//If there are no PARKING SENSOR detects the car, all LED will turn OFF
digitalWrite(50,LOW);
digitalWrite(51,LOW);
digitalWrite(52,LOW);
digitalWrite(53,LOW);
}
if(count=4)//If the SENSOR 1 and SENSOR 2 detect 4 cars the lcd will display "PARKING FULL"
{
lcd.clear();
lcd.print("PARKING FULL");
lcd.setCursor(0,1);
delay(200);
}
}

20/09/2022

Microcontroller Lab 2 MJII
ROBOTIC ARMS CONTROLLED BY POTENTIOMETER by Muhammad Affiq Hakimi Bin Azizi and Mohamad Zaid Bin Mat Yunus from Class Waseda Semester 4 Jan-Jun 2017
--------------------------------------------------------------------------------
Functionality:
-Able to control robots arms just using servo motor, potentiometer with arduino
--------------------------------------------------------------------------------
Hardware Required:
- 4 Servo motors
- Arduino Board
- 10k Potentiometer x4
- Wires
-Breadboard
-------------------------------------------------------------------------------
Connections:
- The external battery VCC / GND connect to the breadboard.
- The Arduino GND connect to the breadboard's GND input
- The servo connections we use in this project are as follows;
Orange Input - Signal Input
Red Input - Power Input (VCC)
Brown Input - Ground Input(GND)
- The potentiometer connections we use in this project are as follows;
Two outer pins are power (VCC) and ground (GND)
Middle pin is signal pin
- The Servo1 VCC and GND connect to the breadboard's VCC / GND inputs
- The Servo1 Signal connect to the Arduino Digital PWM 3
- The Servo2 VCC and GND connect to the breadboard's VCC / GND inputs
- The Servo2 Signal connect to the Arduino Digital PWM 5
- The Servo3 VCC and GND connect to the breadboard's VCC / GND inputs
- The Servo3 Signal connect to the Arduino Digital PWM 6
- The Servo4 VCC and GND connect to the breadboard's VCC / GND inputs
- The Servo4 Signal connect to the Arduino Digital PWM 9
- The Potentiometer's one outer pin connect to the breadboard or the Arduino board VCC input
- The Potentiometer's other outer pin connect to the breadboard or the Arduino board GND input
- The Potentiometer's middle pin connect to the Arduino Analog 8-9-10-11 input
------------------------------------------------------------------------------
Coding:
(Add servo library to Arduino IDE first and then proceed)
//add servo library

//define our servos
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
//define our potentiometers
int pot1 = A8;
int pot2 = A9;
int pot3 = A10;
int pot4 = A11;
//variable to read the values from the analog pin (potentiometers)
int valPot1;
int valPot2;
int valPot3;
int valPot4;
void setup()
{
//attaches our servos on pins PWM 3-5-6-9 to the servos
servo1.attach(3);
servo1.write(0); //define servo1 start position
servo2.attach(5);
servo2.write(90); //define servo2 start position
servo3.attach(6);
servo3.write(90); //define servo3 start position
servo4.attach(9);
servo4.write(70); //define servo4 start position
}
void loop()
{
//reads the value of potentiometers (value between 0 and 1023)
valPot1 = analogRead(pot1);
valPot1 = map (valPot1, 0, 1023, 0, 180); //scale it to use it with the servo (value between 0 and 180)
servo1.write(valPot1); //set the servo position according to the scaled value
valPot2 = analogRead(pot2);
valPot2 = map (valPot2, 0, 1023, 0, 180);
servo2.write(valPot2);
valPot3 = analogRead(pot3);
valPot3 = map (valPot3, 0, 1023, 0, 180);
servo3.write(valPot3);
valPot4 = analogRead(pot4);
valPot4 = map (valPot4, 0, 1023, 70, 180);
servo4.write(valPot4);
}

10/09/2022

Lets Flip the class!! Discussion of programming flow chart build by two teams in a class. With their ๐จ๐ฐ๐ง ๐ฎ๐ง๐๐ž๐ซ๐ฌ๐ญ๐š๐ง๐๐ข๐ง๐  ๐จ๐Ÿ ๐Ÿ๐ฅ๐จ๐ฐ ๐œ๐ก๐š๐ซ๐ญ, each team will develop their own flow chart. The flow chart will then be given to the other team to grade. As if a lecturer will give out a flow chart for student to type the code as an assessment. With this, lecturers can evaluate how well each student understand the concept of flow chart and understanding of procedural programming in microcontroller so we can Implement Personalized Learning method in the next class.

Implementation of Personalized learning is an educational approach that aims to customize learning for each studentโ€™s strengths, needs, skills, and interests

Flipped classroom is a โ€œpedagogical approach in which direct instruction moves from the group learning space to the individual learning space, and the resulting group space is transformed into a dynamic, interactive learning environment where the educator guides students as they apply concepts and engage creatively in the subject matterโ€ (The Flipped Learning Network, 2014).

03/03/2020

Serdang, 3 Mac 2020 โ€“ Setiap tahun negara kita akan menyaksikan graduan daripada pelbagai institusi pendidikan bagi meraikan hari yang penuh bermakna buat mereka namun pada kali ini MARA-Japan Induโ€ฆ

Address

Beranang

Alerts

Be the first to know and let us send you an email when Microcontroller Lab2 MJII posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Share