kefil Tonouewa
/
Project1_Garage_Management_System
garage
Revision 0:d05b3ce87bb4, committed 2021-03-08
- Comitter:
- kefil_tonouewa
- Date:
- Mon Mar 08 18:48:34 2021 +0000
- Commit message:
- my program
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Mon Mar 08 18:48:34 2021 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CONTRIBUTING.md Mon Mar 08 18:48:34 2021 +0000 @@ -0,0 +1,5 @@ +# Contributing to Mbed OS + +Mbed OS is an open-source, device software platform for the Internet of Things. Contributions are an important part of the platform, and our goal is to make it as simple as possible to become a contributor. + +To encourage productive collaboration, as well as robust, consistent and maintainable code, we have a set of guidelines for [contributing to Mbed OS](https://os.mbed.com/docs/mbed-os/latest/contributing/index.html).
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HCSR04.lib Mon Mar 08 18:48:34 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/aralshukaili/code/HCSR04/#0bda99bb39a4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Procedure.txt Mon Mar 08 18:48:34 2021 +0000 @@ -0,0 +1,27 @@ +Use this components to build the project: + Ultasonic Sensor: Determine how close the car/object is to the gate. + Pressure Sensor: Determine whether is it a car or other object. + Servo Motor: To open and close the garage gate. + LCD: To display the number of spot left in the garage. + RGB LED: To represent the red-green light + +NEEDED PARTS: + -SERVO MOTOR https://www.amazon.com/Micro-Servos-Helicopter-Airplane-Controls/dp/B07MLR1498/ref=sr_1_6?dchild=1&keywords=servo+motor&qid=1614047170&s=toys-and-games&sr=1-6 + -RGB LIGHT https://www.amazon.com/ELEGOO-Diffused-Assorted-Flashing-Arduino/dp/B0739VKXYG/ref=sr_1_3?dchild=1&keywords=rgb+arduino&qid=1614047226&sr=8-3 + -PIEZO SPEAKER https://www.amazon.com/mxuteuk-Electronic-Computers-Printers-Components/dp/B07VK1GJ9X/ref=sr_1_4?crid=3CIE4AXXLHG37&dchild=1&keywords=piezo+speaker&qid=1614047495&sprefix=piezo+spea%2Caps%2C183&sr=8-4 + -9V BATTERY https://www.amazon.com/AmazonBasics-Everyday-Alkaline-Batteries-8-Pack/dp/B0774D64LT/ref=sr_1_5?crid=YNWSMFV1I6BK&dchild=1&keywords=9%2Bvolt%2Bbattery&qid=1614047528&sprefix=9%2Bv%2Caps%2C227&sr=8-5&th=1 + -PRESSURE SENSOR https://www.amazon.com/Sensitive-Resistor-Pressure-Diameter-Resistance-Type/dp/B07MP4RL9Q/ref=psdc_306935011_t1_B07T1CHY58 +PLAN: + -Start by changing the color of the lights(5pins total) + -Make the piezo sound as the light go green (4pins total) + -Make the servo motor go up when the light is green and make it go back down and proceed to turn the light back to red(5pins) + -Make the ultrasonic sensor sense object that are close to it (7pins) + -Mesure the pressure of the object to classify it (4pins) + -This is a maybe (hook up the ultrasonic sensor on a servo mortor.) + -close the gate if the pressure sensor is not detecting any pressure + -LCD hook up (10pins) + + 30pins total + + + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Mon Mar 08 18:48:34 2021 +0000 @@ -0,0 +1,64 @@ +![](./resources/official_armmbed_example_badge.png) +# Blinky Mbed OS example + +The example project is part of the [Arm Mbed OS Official Examples](https://os.mbed.com/code/) and is the [getting started example for Mbed OS](https://os.mbed.com/docs/mbed-os/v5.14/quick-start/index.html). It contains an application that repeatedly blinks an LED on supported [Mbed boards](https://os.mbed.com/platforms/). + +You can build the project with all supported [Mbed OS build tools](https://os.mbed.com/docs/mbed-os/latest/tools/index.html). However, this example project specifically refers to the command-line interface tool [Arm Mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). +(Note: To see a rendered example you can import into the Arm Online Compiler, please see our [import quick start](https://os.mbed.com/docs/mbed-os/latest/quick-start/online-with-the-online-compiler.html#importing-the-code).) + +1. [Install Mbed CLI](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html). + +1. Clone this repository on your system, and change the current directory to where the project was cloned: + + ```bash + $ git clone git@github.com:armmbed/mbed-os-example-blinky && cd mbed-os-example-blinky + ``` + + Alternatively, you can download the example project with Arm Mbed CLI using the `import` subcommand: + + ```bash + $ mbed import mbed-os-example-blinky && cd mbed-os-example-blinky + ``` + + +## Application functionality + +The `main()` function is the single thread in the application. It toggles the state of a digital output connected to an LED on the board. + +## Building and running + +1. Connect a USB cable between the USB port on the board and the host computer. +2. <a name="build_cmd"></a> Run the following command to build the example project and program the microcontroller flash memory: + ```bash + $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash + ``` +The binary is located at `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-blinky.bin`. + +Alternatively, you can manually copy the binary to the board, which you mount on the host computer over USB. + +Depending on the target, you can build the example project with the `GCC_ARM`, `ARM` or `IAR` toolchain. After installing Arm Mbed CLI, run the command below to determine which toolchain supports your target: + +```bash +$ mbed compile -S +``` + +## Expected output +The LED on your target turns on and off every 500 milliseconds. + + +## Troubleshooting +If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it. + +## Related Links + +* [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html). +* [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html). +* [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html). +* [Mbed OS bare metal](https://os.mbed.com/docs/mbed-os/latest/reference/mbed-os-bare-metal.html). +* [Mbed boards](https://os.mbed.com/platforms/). + +### License and contributions + +The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see contributing.md for more info. + +This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Mon Mar 08 18:48:34 2021 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/Servo/#36b69a7ced07
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Mar 08 18:48:34 2021 +0000 @@ -0,0 +1,115 @@ +#include "mbed.h" +#include "HCSR04.h" +#include "Servo.h" + +#define PARKING_SPACE_TOTAL 100 + +//Light Pin Assignment +#define RED_1_PIN D6 +#define RED_2_PIN D7 +#define GREEN_1_PIN D8 +#define GREEN_2_PIN D9 + +//Piezo Speaker Pin Assignment +#define PIEZO_BUZZER_1_PIN D3 +#define PIEZO_BUZZER_2_PIN D11 + +//Servo Motor Pin Assignment +#define SERVO_MOTOR_1_PIN PTA1 +//#define SERVO_MOTOR_2_PIN D10 + +//Ultrasonic Sensor Pin Assignment +#define ECHO_1_PIN D0 +#define TRIGGER_1_PIN D1 +#define ECHO_2_PIN D4 +#define TRIGGER_2_PIN D5 + +//Pressure Sensor Pin Assignement +#define PRESSURE_1_PIN A0 +#define PRESSURE_2_PIN A1 +#define VCC 5.00 +#define R_DIV 3230.0 + +//LCD Pin Assignment + +//Setting up the lights as output +DigitalOut RED_LIGHT_1(RED_1_PIN); +DigitalOut RED_LIGHT_2(RED_2_PIN); +DigitalOut GREEN_LIGHT_1(GREEN_1_PIN); +DigitalOut GREEN_LIGHT_2(GREEN_2_PIN); + +//Setting up the Ultrasonic Sensors +DigitalOut ECHO_1(ECHO_1_PIN); +DigitalIn TRIGGER_1(TRIGGER_1_PIN); +DigitalOut ECHO_2(ECHO_2_PIN); +DigitalIn TRIGGER_2(TRIGGER_2_PIN); + +//Setting up the Servo Motors +//DigitalOut SERVO_1(SERVO_MOTOR_1_PIN); +//DigitalOut SERVO_2(SERVO_MOTOR_2_PIN); + +//Setting up Piezo Speakers +DigitalOut PIEZO_1(PIEZO_BUZZER_1_PIN); +DigitalOut PIEZO_2(PIEZO_BUZZER_2_PIN); + +//Setting up the Pressure Sensors +AnalogIn PRESSURE_1 (PRESSURE_1_PIN); +AnalogIn PRESSURE_2 (PRESSURE_2_PIN); + +int main() +{ + /* + //Car counting variables + int8_t Car_In = 0; + int8_t Car_Out = 0; + + //Setting the red lights to 1 + RED_LIGHT_1 = 1; + RED_LIGHT_2 = 1; + + //Setting the green lights to 0 + GREEN_LIGHT_1 = 0; + GREEN_LIGHT_2 = 0; + + //Ultrasonic Sensor Stuff + //If the value fetched from here is less than a certain value + //Than we know there is an object close to the gate else we + //don't change anything + HCSR04 Ultrasonic_1(TRIGGER_1_PIN,ECHO_1_PIN); + HCSR04 Ultrasonic_2(TRIGGER_2_PIN,ECHO_2_PIN); + bool isObjectClose_1 = false; + bool isObjectClose_2 = false; + uint8_t Distance_1 = 0; + uint8_t Distance_2 = 0; + + //Pressure Sensor Stuff + //If the value fetched from here is greater than a certain value + //than we know it is a car else we don't change anything + int Pressure_Sensor_1 = 0; + float fsrR_1; + float fsrV_1; + float fsrG_1; + float force_1; + int Pressure_Sensor_2 = 0; + float fsrR_2; + float fsrV_2; + float fsrG_2; + float force_2; + bool isCar_1 = false; + bool isCar_2 = false; +*/ + //Servo Motor Stuff + Servo entranceGate(PTA1); + //Servo exitGate(SERVO_MOTOR_2_PIN); + + + + while(1) { + + for(float p=0; p<1.0; p += 0.1) + { + entranceGate = p; + wait(0.2); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Mon Mar 08 18:48:34 2021 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#cf4f12a123c05fcae83fc56d76442015cb8a39e9
Binary file resources/official_armmbed_example_badge.png has changed