Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed C12832 LM75B
Revision 0:8bf954873391, committed 2021-10-13
- Comitter:
- jojofannum69
- Date:
- Wed Oct 13 13:51:26 2021 +0000
- Commit message:
- .
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Wed Oct 13 13:51:26 2021 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Wed Oct 13 13:51:26 2021 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/askksa12543/code/C12832/#990d5eec2ef6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CONTRIBUTING.md Wed Oct 13 13:51:26 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/LM75B.lib Wed Oct 13 13:51:26 2021 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/neilt6/code/LM75B/#7ac462ba84ac
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Wed Oct 13 13:51:26 2021 +0000 @@ -0,0 +1,64 @@ + +# 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/main.cpp Wed Oct 13 13:51:26 2021 +0000
@@ -0,0 +1,210 @@
+#include "mbed.h"
+#include "C12832.h"
+#include "pitchs.h"
+#include "LM75B.h"
+
+LM75B sensor(D14, D15);
+PwmOut spkr (D6);
+DigitalIn up(A2);
+DigitalIn down(A3);
+DigitalIn left(A4);
+DigitalIn right(A5);
+DigitalIn center(D4);
+C12832 lcd(D11, D13, D12, D7, D10);
+enum {CLL,MARIO,JOUE,Sensor} etat = CLL;
+
+int menu_precedent = MARIO;
+char message_precedent[]=" ";
+
+void mario(){
+
+int melody[] = {
+ NOTE_E7, NOTE_E7, 0, NOTE_E7,
+ 0, NOTE_C7, NOTE_E7, 0,
+ NOTE_G7, 0, 0, 0,
+ NOTE_G6, 0, 0, 0,
+
+ NOTE_C7, 0, 0, NOTE_G6,
+ 0, 0, NOTE_E6, 0,
+ 0, NOTE_A6, 0, NOTE_B6,
+ 0, NOTE_AS6, NOTE_A6, 0,
+
+ NOTE_G6, NOTE_E7, NOTE_G7,
+ NOTE_A7, 0, NOTE_F7, NOTE_G7,
+ 0, NOTE_E7, 0,NOTE_C7,
+ NOTE_D7, NOTE_B6, 0, 0,
+
+ NOTE_C7, 0, 0, NOTE_G6,
+ 0, 0, NOTE_E6, 0,
+ 0, NOTE_A6, 0, NOTE_B6,
+ 0, NOTE_AS6, NOTE_A6, 0,
+
+ NOTE_G6, NOTE_E7, NOTE_G7,
+ NOTE_A7, 0, NOTE_F7, NOTE_G7,
+ 0, NOTE_E7, 0,NOTE_C7,
+ NOTE_D7, NOTE_B6, 0, 0
+};
+
+int noteDurations[] = {
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 9, 9, 9,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 9, 9, 9,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+ 12, 12, 12, 12,
+};
+
+ for (int thisNote = 0; thisNote < 52; thisNote++) {
+ int noteDuration = noteDurations[thisNote];
+ spkr.period(1.0/melody[thisNote]);
+ spkr=0.25;
+ wait(1.0/noteDuration);
+ int pauseBetweenNotes = noteDuration * 1.30;
+ wait(1.0/pauseBetweenNotes);
+ spkr=0;
+ }
+}
+
+void cll(){
+#define DO 262
+#define RE 294
+#define MI 330
+
+int melody[] = {DO, DO, DO, RE, MI, RE, DO, MI, RE, RE, DO};
+int noteDurations[] = {4,4,4,8,8,4,4,4,4,12};
+for (int thisNote = 0; thisNote < 52; thisNote++) {
+ // to calculate the note duration, take one second
+ // divided by the note type.
+ //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
+ int noteDuration = noteDurations[thisNote];
+ //tone(8, melody[thisNote],noteDuration);
+ spkr.period(1.0/melody[thisNote]);
+ spkr=0.25;
+ wait(1.0/noteDuration);
+ //wait(1);
+ // to distinguish the notes, set a minimum time between them.
+ // the note's duration + 30% seems to work well:
+ int pauseBetweenNotes = noteDuration * 1.30;
+ //wait(pauseBetweenNotes/1000);
+ wait(1.0/pauseBetweenNotes);
+ // stop the tone playing:
+ //noTone(8);
+ spkr=0;
+}
+}
+
+void Afficher_Menu(int Menu)
+{
+ if (menu_precedent == Menu) return;
+ menu_precedent = Menu;
+ lcd.cls();
+ lcd.locate(0,8);
+ //wait(0.050);
+ switch(Menu) {
+ case CLL :
+ lcd.printf("Claire de la lune");
+ break;
+ case MARIO :
+ lcd.printf("Mario");
+ break;
+ case JOUE :
+ lcd.printf("JOUE");
+ break;
+ }
+}
+
+void Afficher_Message(char *Message)
+{
+ if (strcmp(message_precedent,Message) ==0) return;
+ lcd.cls();
+ lcd.locate(0,8);
+ lcd.printf(Message);
+
+}
+
+void Menu_CLL(int etat)
+{
+ bool Sortir = false; // On sort du sous-menu
+ while (!Sortir) {
+ Afficher_Menu(etat);
+ switch (etat) {
+ case JOUE :
+ // évèments
+ if (left) {
+ etat = CLL;
+ Sortir=true;
+ }
+ if (center)cll();
+ break;
+ }
+ wait(0.125);
+
+ }
+}
+
+
+void Menu_Mario(int etat)
+{
+ bool Sortir = false; // On sort du sous-menu
+ while (!Sortir) {
+ Afficher_Menu(etat);
+ switch (etat) {
+ case JOUE :
+ // évèments
+ if (left) {
+ etat = MARIO;
+ Sortir=true;
+ }
+ if (center)mario();
+ break;
+ }
+ wait(0.125);
+
+ }
+}
+
+
+int main()
+{
+ while (1) {
+ Afficher_Menu(etat);
+ switch (etat) {
+ case CLL :
+ // évèments
+ if (down) etat = MARIO;
+ if (right) Menu_CLL(JOUE);
+ break;
+ case MARIO :
+ if (up) etat=CLL;
+ if (right) Menu_Mario(JOUE);
+ if (down) etat = Sensor;
+ break;
+ case Sensor :
+ lcd.cls();
+ lcd.printf(" ");
+ lcd.locate(0,8);
+ lcd.printf("Temp = %.3f\n\r", (float)sensor);
+ wait(0.5);
+ if (up) etat=MARIO;
+ break;
+
+ }
+ wait(0.125);
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Oct 13 13:51:26 2021 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pitchs.h Wed Oct 13 13:51:26 2021 +0000 @@ -0,0 +1,93 @@ +/************************************************* + * Public Constants + *************************************************/ + +#define NOTE_B0 31 +#define NOTE_C1 33 +#define NOTE_CS1 35 +#define NOTE_D1 37 +#define NOTE_DS1 39 +#define NOTE_E1 41 +#define NOTE_F1 44 +#define NOTE_FS1 46 +#define NOTE_G1 49 +#define NOTE_GS1 52 +#define NOTE_A1 55 +#define NOTE_AS1 58 +#define NOTE_B1 62 +#define NOTE_C2 65 +#define NOTE_CS2 69 +#define NOTE_D2 73 +#define NOTE_DS2 78 +#define NOTE_E2 82 +#define NOTE_F2 87 +#define NOTE_FS2 93 +#define NOTE_G2 98 +#define NOTE_GS2 104 +#define NOTE_A2 110 +#define NOTE_AS2 117 +#define NOTE_B2 123 +#define NOTE_C3 131 +#define NOTE_CS3 139 +#define NOTE_D3 147 +#define NOTE_DS3 156 +#define NOTE_E3 165 +#define NOTE_F3 175 +#define NOTE_FS3 185 +#define NOTE_G3 196 +#define NOTE_GS3 208 +#define NOTE_A3 220 +#define NOTE_AS3 233 +#define NOTE_B3 247 +#define NOTE_C4 262 +#define NOTE_CS4 277 +#define NOTE_D4 294 +#define NOTE_DS4 311 +#define NOTE_E4 330 +#define NOTE_F4 349 +#define NOTE_FS4 370 +#define NOTE_G4 392 +#define NOTE_GS4 415 +#define NOTE_A4 440 +#define NOTE_AS4 466 +#define NOTE_B4 494 +#define NOTE_C5 523 +#define NOTE_CS5 554 +#define NOTE_D5 587 +#define NOTE_DS5 622 +#define NOTE_E5 659 +#define NOTE_F5 698 +#define NOTE_FS5 740 +#define NOTE_G5 784 +#define NOTE_GS5 831 +#define NOTE_A5 880 +#define NOTE_AS5 932 +#define NOTE_B5 988 +#define NOTE_C6 1047 +#define NOTE_CS6 1109 +#define NOTE_D6 1175 +#define NOTE_DS6 1245 +#define NOTE_E6 1319 +#define NOTE_F6 1397 +#define NOTE_FS6 1480 +#define NOTE_G6 1568 +#define NOTE_GS6 1661 +#define NOTE_A6 1760 +#define NOTE_AS6 1865 +#define NOTE_B6 1976 +#define NOTE_C7 2093 +#define NOTE_CS7 2217 +#define NOTE_D7 2349 +#define NOTE_DS7 2489 +#define NOTE_E7 2637 +#define NOTE_F7 2794 +#define NOTE_FS7 2960 +#define NOTE_G7 3136 +#define NOTE_GS7 3322 +#define NOTE_A7 3520 +#define NOTE_AS7 3729 +#define NOTE_B7 3951 +#define NOTE_C8 4186 +#define NOTE_CS8 4435 +#define NOTE_D8 4699 +#define NOTE_DS8 4978
Binary file resources/official_armmbed_example_badge.png has changed