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.
Revision 12:7c9c5a541380, committed 2016-06-28
- Comitter:
- Schreeker
- Date:
- Tue Jun 28 19:40:19 2016 +0000
- Parent:
- 11:5861bc23022a
- Child:
- 13:676721490d37
- Commit message:
- Hinzufuegen der Funktion initLED. LED's blinken beim Starten des Programmes 4 mal kurz auf, dann beginnt das Hauptprogramm. Simon Rutzen
Changed in this revision
--- a/LED.cpp Tue Jun 28 19:05:15 2016 +0000
+++ b/LED.cpp Tue Jun 28 19:40:19 2016 +0000
@@ -40,4 +40,38 @@
// Tbd
/* Einstellen der LED's */
// Tbd mit Switch-Case-Struktur
- }
\ No newline at end of file
+ }
+
+/************************************************************************************
+* void void initLED()
+* Zweck: Blinken der LED's beim Anschalten des Boards. 4x Blinken im 250ms Abstand
+* Parameter:
+ keine
+* return Parameter:
+ keine
+*************************************************************************************/
+void initLED(){
+ /* Variabeln */
+ int i = 0;
+
+ /* Setzen der PWM-Periode auf 20ms */
+ oLEDXN.period_ms(20);
+ oLEDXP.period_ms(20);
+ oLEDYN.period_ms(20);
+ oLEDYP.period_ms(20);
+
+ /* 4x Blinken der LED's mit 250ms Pause dazwischen*/
+ while(i<8){
+ /* Toggeln der LED's */
+ oLEDXN = ((int)oLEDXN.read()+1) % 2;
+ oLEDXP = ((int)oLEDXP.read()+1) % 2;
+ oLEDYN = ((int)oLEDYN.read()+1) % 2;
+ oLEDYP = ((int)oLEDYP.read()+1) % 2;
+
+ /* Warten */
+ wait_ms(250);
+
+ /* Zählvariabel erhöhen */
+ ++i;
+ }
+ }
\ No newline at end of file
--- a/LED.h Tue Jun 28 19:05:15 2016 +0000 +++ b/LED.h Tue Jun 28 19:40:19 2016 +0000 @@ -6,4 +6,5 @@ * Changes: keine ***********************************************************************************/ -void setLED(struct WinkelData stWinkelData); \ No newline at end of file +void setLED(struct WinkelData stWinkelData); +void initLED(); \ No newline at end of file
--- a/main.cpp Tue Jun 28 19:05:15 2016 +0000
+++ b/main.cpp Tue Jun 28 19:40:19 2016 +0000
@@ -13,6 +13,7 @@
#include "LCD.h"
#include "cdef.h"
#include "Sensor.h"
+#include "LED.h"
/*Structs*/
extern struct WinkelData stWinkelData;
@@ -20,6 +21,9 @@
/* Hauptprogramm */
int main(){
+ /* Blinken der LED's zum Start (Hello) */
+ initLED();
+
while(1){
/* Auslesen des Beschleunigungssensores */
vgetSensData(&stSensData);
@@ -37,7 +41,7 @@
//vLCDSet(stWinkelData.i16WinkelX, stWinkelData.i16WinkelY);
vLCDDebug(stWinkelData.i16WinkelX, stWinkelData.i16WinkelY, stWinkelData.i16WinkelZ);
/* Pause */
- wait_ms(500);
+ wait_ms(250);
}
return 0;
}