Printowanie i scanf w putty :D

Dependencies:   mbed

Fork of Nucleo_printf2 by PWSZ Konsola Projekt

Files at this revision

API Documentation at this revision

Comitter:
marcin921211
Date:
Thu May 15 16:10:36 2014 +0000
Parent:
1:e9d1c42a73ae
Commit message:
printf scanf

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Feb 28 06:52:34 2014 +0000
+++ b/main.cpp	Thu May 15 16:10:36 2014 +0000
@@ -6,16 +6,30 @@
 //------------------------------------
 
 Serial pc(SERIAL_TX, SERIAL_RX);
+InterruptIn mybutton(PC_13);
  
 DigitalOut myled(LED1);
  
+void pressed()
+{
+    pc.printf("Przycisk!\n\r");
+    
+} 
+ 
 int main() {
+  mybutton.fall(&pressed);
   int i = 1;
-  pc.printf("Hello World !\n");
-  while(1) { 
+  pc.printf("Numer: %i\n\r", i);
+  pc.printf("While\n\r");
+  pc.printf("Nie while. Wpisz cos: ");
+  char str[20];
+  pc.scanf ("%79s",str);
+  pc.printf("\n\rTwoj tekst: %s",str);
+  while(true) { 
       wait(1);
-      pc.printf("This program runs since %d seconds.\n", i++);
-      myled = !myled;
+      pc.printf("Numer: %i\n\r", i);
+      myled = 1;
+      i++;
   }
 }
  
\ No newline at end of file