Example code stm32nucleof401re_00_blinkled
Dependencies: mbed-os
Revision 0:6d3e4f76ec5f, committed 2020-02-05
- Comitter:
- perlatecnica
- Date:
- Wed Feb 05 16:56:45 2020 +0000
- Commit message:
- v1.0
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed-os.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 6d3e4f76ec5f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 05 16:56:45 2020 +0000 @@ -0,0 +1,41 @@ +/* Copyright (c) 2019 Perlatecnica + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/**************************************************** +* RAPID PROTOTYPING WITH NUCLEO * +* Example Code 00: Blink Led * +* Author: Mauro D'Angelo * +* Organization: Perlatecnica * +*****************************************************/ + +#include "mbed.h" + +// It creates an instance of the DigitalOut class. +// myled is the name of the variable (instance). +// The instance shall 'point' to the pin LED1, that is the led on the board +DigitalOut myled(LED1); + +// Entry point +int main() { + // Led blinking - The led is switched on and off + while(1) { + myled = 1; // The LED is ON + wait(0.2); // Stop the program counter here and wait for 200 ms. In the meanwhile the led is on + myled = 0; // Switch-off the LED + wait(1.0); // Stop the program counter here and wait for 1 ms. In the meanwhile the led is off + } +} + +// EXERCISE: Modify the interval between the led status changing instructions \ No newline at end of file
diff -r 000000000000 -r 6d3e4f76ec5f mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Wed Feb 05 16:56:45 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/EL4121-Embedded-System/code/mbed-os/#b74591d5ab33