Joachim Schaeffer
/
Roboter
g
Fork of Roboter by
Runden_Anzeigen_cpp.h@0:d453d7554981, 2017-01-11 (annotated)
- Committer:
- spolak
- Date:
- Wed Jan 11 09:43:00 2017 +0000
- Revision:
- 0:d453d7554981
Klassen zum Blinken und Umwandeln vom Text
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spolak | 0:d453d7554981 | 1 | //LEDs ansteuern |
spolak | 0:d453d7554981 | 2 | #include "mbed.h" |
spolak | 0:d453d7554981 | 3 | #include "m3pi_ng.h" |
spolak | 0:d453d7554981 | 4 | #include "LED_ansteuern.h" |
spolak | 0:d453d7554981 | 5 | #include <sstream> |
spolak | 0:d453d7554981 | 6 | |
spolak | 0:d453d7554981 | 7 | m3pi pi; |
spolak | 0:d453d7554981 | 8 | |
spolak | 0:d453d7554981 | 9 | int main() |
spolak | 0:d453d7554981 | 10 | { |
spolak | 0:d453d7554981 | 11 | LEDD A; //Klasseninstanz A |
spolak | 0:d453d7554981 | 12 | int Runden=0; |
spolak | 0:d453d7554981 | 13 | string str; //für die Umwandlung in String |
spolak | 0:d453d7554981 | 14 | stringstream s; //für die Umwandlung in stringstram |
spolak | 0:d453d7554981 | 15 | |
spolak | 0:d453d7554981 | 16 | while (1) |
spolak | 0:d453d7554981 | 17 | { |
spolak | 0:d453d7554981 | 18 | A.Runden(Runden); |
spolak | 0:d453d7554981 | 19 | |
spolak | 0:d453d7554981 | 20 | s << Runden;// Zahl hinzufügen, in Stringstram |
spolak | 0:d453d7554981 | 21 | str = s.str(); //stringstram in string umwandeln |
spolak | 0:d453d7554981 | 22 | const char * y = str.c_str(); //Wandelt String in const char* um |
spolak | 0:d453d7554981 | 23 | |
spolak | 0:d453d7554981 | 24 | pi.printf(y); //Zeigt die Rundenzahl an |
spolak | 0:d453d7554981 | 25 | wait(0.5); |
spolak | 0:d453d7554981 | 26 | pi.cls(); |
spolak | 0:d453d7554981 | 27 | |
spolak | 0:d453d7554981 | 28 | str = ""; //Löscht str |
spolak | 0:d453d7554981 | 29 | s.str(""); //stringstream löschen |
spolak | 0:d453d7554981 | 30 | |
spolak | 0:d453d7554981 | 31 | Runden++; |
spolak | 0:d453d7554981 | 32 | } |
spolak | 0:d453d7554981 | 33 | } |
spolak | 0:d453d7554981 | 34 | //Ab 46? kommt die nächste Zeile |
spolak | 0:d453d7554981 | 35 | //je 8 Zeichenfelder |