diff options
author | Fede85 <f.vanzati@gmail.com> | 2013-09-06 15:38:07 +0200 |
---|---|---|
committer | Fede85 <f.vanzati@gmail.com> | 2013-09-06 15:38:07 +0200 |
commit | a3e2e68e2b7edb9f5434734bed4001df1e65451c (patch) | |
tree | d4ef938bd8179a15d41b19197c51ca0a7f93936f /libraries/Bridge/examples/ConsoleRead/ConsoleRead.ino | |
parent | 35f10e412f5d00027f9d7f2036243c681dbec406 (diff) |
Bridge library to the 1.5 format
Diffstat (limited to 'libraries/Bridge/examples/ConsoleRead/ConsoleRead.ino')
-rw-r--r-- | libraries/Bridge/examples/ConsoleRead/ConsoleRead.ino | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/libraries/Bridge/examples/ConsoleRead/ConsoleRead.ino b/libraries/Bridge/examples/ConsoleRead/ConsoleRead.ino deleted file mode 100644 index 0019c20..0000000 --- a/libraries/Bridge/examples/ConsoleRead/ConsoleRead.ino +++ /dev/null @@ -1,56 +0,0 @@ -/* - Console Read example - - Read data coming from bridge using the Console.read() function - and store it in a string. - - To see the Console, pick your Yún's name and IP address in the Port menu - then open the Port Monitor. You can also see it by opening a terminal window - and typing: - ssh root@ yourYunsName.local 'telnet localhost 6571' - then pressing enter. When prompted for the password, enter it. - - created 13 Jun 2013 - by Angelo Scialabba - modified 16 June 2013 - by Tom Igoe - - This example code is in the public domain. - */ - -#include <Console.h> - -String name; - -void setup() { - // Initialize Console and wait for port to open: - Bridge.begin(); - Console.begin(); - - // Wait for Console port to connect - while (!Console); - - Console.println("Hi, what's your name?"); -} - -void loop() { - if (Console.available() > 0) { - char c = Console.read(); // read the next char received - // look for the newline character, this is the last character in the string - if (c == '\n') { - //print text with the name received - Console.print("Hi "); - Console.print(name); - Console.println("! Nice to meet you!"); - Console.println(); - // Ask again for name and clear the old name - Console.println("Hi, what's your name?"); - name = ""; // clear the name string - } - else { // if the buffer is empty Cosole.read() returns -1 - name += c; // append the read char from Console to the name string - } - } -} - - |